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

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -