Skip to main content
Use named hyperlink instead of bare URL
Source Link
AdminBee
  • 23.6k
  • 25
  • 56
  • 77

OK--II think I've figured it out.

set command5 "echo '#!/bin/bash\n\ndeclare -i last_reboot=\$(w | grep up | grep days | awk '\\\''\{print \$3\}'\\\'')\n\nif....." > script.sh

The above produces the following:

#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."
#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."

I found the answer at this link: https://www.linuxquestions.org/questions/linux-newbie-8/problem-escaping-single-quote-when-using-usr-bin-expect-c-4175600628/here:

. I just had not figured out the correct escape sequence.

OK--I think I've figured it out.

set command5 "echo '#!/bin/bash\n\ndeclare -i last_reboot=\$(w | grep up | grep days | awk '\\\''\{print \$3\}'\\\'')\n\nif....." > script.sh

The above produces the following:

#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."

I found the answer at this link: https://www.linuxquestions.org/questions/linux-newbie-8/problem-escaping-single-quote-when-using-usr-bin-expect-c-4175600628/:

I just had not figured out the correct escape sequence.

I think I've figured it out.

set command5 "echo '#!/bin/bash\n\ndeclare -i last_reboot=\$(w | grep up | grep days | awk '\\\''\{print \$3\}'\\\'')\n\nif....." > script.sh

The above produces the following:

#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."

I found the answer here. I just had not figured out the correct escape sequence.

an external link was inside a code block, so I converted it to a link
Source Link

OK--I think I've figured it out.

set command5 "echo '#!/bin/bash\n\ndeclare -i last_reboot=\$(w | grep up | grep days | awk '\\\''\{print \$3\}'\\\'')\n\nif....." > script.sh

The above produces the following:

#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."

I found the answer at this link: https://www.linuxquestions.org/questions/linux-newbie-8/problem-escaping-single-quote-when-using-usr-bin-expect-c-4175600628/:

https://www.linuxquestions.org/questions/linux-newbie-8/problem-escaping-single-quote-when-using-usr-bin-expect-c-4175600628/

I just had not figured out the correct escape sequence.

OK--I think I've figured it out.

set command5 "echo '#!/bin/bash\n\ndeclare -i last_reboot=\$(w | grep up | grep days | awk '\\\''\{print \$3\}'\\\'')\n\nif....." > script.sh

The above produces the following:

#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."

I found the answer at this link:

https://www.linuxquestions.org/questions/linux-newbie-8/problem-escaping-single-quote-when-using-usr-bin-expect-c-4175600628/

I just had not figured out the correct escape sequence.

OK--I think I've figured it out.

set command5 "echo '#!/bin/bash\n\ndeclare -i last_reboot=\$(w | grep up | grep days | awk '\\\''\{print \$3\}'\\\'')\n\nif....." > script.sh

The above produces the following:

#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."

I found the answer at this link: https://www.linuxquestions.org/questions/linux-newbie-8/problem-escaping-single-quote-when-using-usr-bin-expect-c-4175600628/:

I just had not figured out the correct escape sequence.

Source Link
Mike
  • 1
  • 1

OK--I think I've figured it out.

set command5 "echo '#!/bin/bash\n\ndeclare -i last_reboot=\$(w | grep up | grep days | awk '\\\''\{print \$3\}'\\\'')\n\nif....." > script.sh

The above produces the following:

#!/bin/bash

declare -i last_reboot=$(w | grep up | grep days | awk '{print $3}')

if (( $last_reboot >= 7 )); then
echo "Your ..."

I found the answer at this link:

https://www.linuxquestions.org/questions/linux-newbie-8/problem-escaping-single-quote-when-using-usr-bin-expect-c-4175600628/

I just had not figured out the correct escape sequence.