Page 2 of 2

Re: ??? What am I missing?? Newbie scripting err. (Solved)

Posted: 21 Aug 2014, 03:19
by brokenman
So what is the difference between our scripts?

su -c 'sh $0'

su -c "sh $0"

EDIT:
http://linuxcommand.org/wss0060.php

Re: ??? What am I missing?? Newbie scripting err. (Solved)

Posted: 21 Aug 2014, 04:04
by Ed_P
brokenman wrote:So what is the difference between our scripts?

su -c 'sh $0'

su -c "sh $0"
:shock:
Well, one script used copy and paste from what you posted
brokenman wrote:In that case it would be something like: su - -c 'sh $0'
the other cheated and apparently searched the web for how to do it. :evil:


I should have used the new command that I saw recently.

Code: Select all

guest@porteus:~$ diff testY.sh testX.sh
4c4
<   su -c 'sh $0'
---
>   su -c "sh $0"
guest@porteus:~$ 
An interesting read. Thanks.

Re: ??? What am I missing?? Newbie scripting err. (Solved)

Posted: 22 Aug 2014, 00:14
by brokenman
Well, one script used copy and paste from what you posted
Yes, sorry. I often get caught out by quotes in scripts. The first one failed and I immediately suspected the variable inside single quotes.