In shell scripts
set -e
is often used to make them more robust by stopping the script when some of the commands executed from the script exits with non-zero exit code.if then else
if [ -d $directory ]; then echo "Directory exists" else echo "Directory does not exists" fi
Please note the spacing inside the [ and ] brackets! Without the spaces, it won't work!
${PWD##*/}
get leaf directory of pwd. Eg.
> echo $PWD
/home/wilsonhong
> echo {$PWD##*/}
wilsonhong
-d
if [ -d "$DIRECTORY" ]
check directory exist or not
gnome-terminal -e "<cmd>"
run command interminal
find . -iname "*.pyc" -exec rm -f {} \;
delete all .pyc files
沒有留言:
張貼留言