Tagged: shell

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...

0

Print a line of a local file in using command line

Print 15th line using sed sed -n “15p” hello-world.js Print 15-25 line using sed sed -n “15,25p” hello-world.js Print 15-25 line with line numbers using sed sed -n “10,20p” hello-world.js | less -N