linux - Executing a set of commands inside a new bash instance from as script -
i'm trying execute set of commands in new bash session:
exec bash <<- eof ln -snf $jdk_repo'/jdk'$1 $current; java_home=$(readlink -f $current); echo $java_home; export path= $java_home/bin:$path; exec usejdk eof i error :
warning: here-document @ line 46 delimited end-of-file (wanted `eof') i tried debug whatswrongwithmyscript, :
use <<- instead of << if want indent end token. any suggestion execute set of commands in new bash instance ?
doing way works me:
cmd=" ln -snf $jdk_repo'/jdk'$1 $current; java_home=$(readlink -f $current); echo $java_home; export path= $java_home/bin:$path; exec usejdk" bash <<< "$cmd" the bash <<< "$cmd" equivalent echo "$cmd" | bash or bash -c "$cmd"
Comments
Post a Comment