Enclosing a command in escape characters in bash -


i have command in quotes:

 ssh -i "/home/$user/$key" "$user"@"$worker1ip"   "echo 'if [[ `uname -a` == darwin* ]]; then' >> /home/$user/tachyon-0.5.0/conf/tachyon-env.sh" 

the "uname" part has written literally, not executed. tried using "\" before 'uname' part, don't know how close it. can please?

this should work:

ssh -i "/home/$user/$key" "$user"@"$worker1ip"   "echo 'if [[ \"\$(uname -a)\" == darwin* ]]; then' >> /home/$user/tachyon-0.5.0/conf/tachyon-env.sh" 

and too:

ssh -i "/home/$user/$key" "$user"@"$worker1ip"   "echo 'if [[ \`uname -a\` == darwin* ]]; then' >> /home/$user/tachyon-0.5.0/conf/tachyon-env.sh" 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -