Category: Bash

0

Bash scripting missing ‘]’

If you have the simple script like the following : #!/bin/bash if [ $foo = ‘bar’]; then echo ‘Foo is equal to bar’ fi And when you run the script, if you get the...

0

How to create scripts in terminal

Follow three simple steps to automate your terminal. Create a script Set the permissions Execute the script Create a script test.sh $vi test.sh ls -la echo ‘Hello Bash!’ Set the permissions $sudo chmod 777...

0

[: !=: unary operator expected

In bash, always use the double bracket conditional command [[ … ]] For example, #!/bin/bash sex=male if [[ $sex == ‘male’ ]];then echo “sex is male.” elif [[ $sex == ‘female’ ]];then echo “sex...