bash - Seeing shell commands as they are being executed including variables -


this question has answer here:

i can do

bash -x mysellh.sh 

to see commands being executed, don't see variables replaced values. instance, if have in shell script:

screen -d -m sh -c 'rails_env="$r_env" bundle exec rake sunspot:solr:reindex[500] > "$project_dir"/solr/indexing_out.txt' 

i see:

+ screen -d -m sh -c 'rails_env="$r_env" bundle exec rake sunspot:solr:reindex[500] > "$project_dir"/solr/indexing_out.txt' 

even though i've declared earlier:

r_env=test 

is there option want?

in case, doing asked: command line "word" $r_env in have enclosed in single quotes, inhibit expansion. -x output showing non-expansion. if want variables expanded, enclose first "word" in double quotes , use single quotes in contents, this:

screen -d -m sh -c "rails_env='$r_env' bundle exec rake sunspot:solr:reindex[500] > '$project_dir'/solr/indexing_out.txt" 

then single quotes around expanded text , double quotes allow variables expand.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -