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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -