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

Post here if you are a new Porteus member and you're looking for some help.
User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

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

Post#16 by brokenman » 21 Aug 2014, 03:19

So what is the difference between our scripts?

su -c 'sh $0'

su -c "sh $0"

EDIT:
http://linuxcommand.org/wss0060.php
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

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

Post#17 by Ed_P » 21 Aug 2014, 04:04

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.
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

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

Post#18 by brokenman » 22 Aug 2014, 00:14

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.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply