shell - Bash script to hit enter to continue or enter new directory -
hi i'm trying script continue if enter hit or take input variable code is:
echo " hit enter default directory or insert new directory" read var if [ var = *enter* ] echo "enter pressed" else echo $var fi
please use enter me not knowing comes next
this script prints "default directory" if enter pressed, , name of new directory if else entered:
#!/bin/bash echo "hit enter default directory or insert new directory" read var if [[ $var = "" ]]; echo "default directory" else echo "new directory: $var" fi
Comments
Post a Comment