what am I missing??? [Solved]

Post here if you are a new Porteus member and you're looking for some help.
Post Reply
User avatar
Ed_P
Contributor
Contributor
Posts: 3212
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

what am I missing??? [Solved]

Post#1 by Ed_P » 05 May 2014, 03:23

If I run this command via lxterminal I get this output:

Code: Select all

root@porteus:/home/guest# ls -R /mnt/live/memory/changes/home
/mnt/live/memory/changes/home:
guest/

/mnt/live/memory/changes/home/guest:
Backups/  Downloads/  mychanges.sh

/mnt/live/memory/changes/home/guest/Backups:
FireFox/

/mnt/live/memory/changes/home/guest/Backups/FireFox:

/mnt/live/memory/changes/home/guest/Downloads:
java-builder/  p11-kit-compat32-0.16.4-x86_64-1compat32.txz

/mnt/live/memory/changes/home/guest/Downloads/java-builder:
root@porteus:/home/guest# 
If I run the same command via a script in lxterminal I get this:

Code: Select all

guest@porteus:~$ ./mychanges.sh
bash: ./mychanges.sh: Permission denied
guest@porteus:~$ su
Password: 
root@porteus:/home/guest# ./mychanges.sh
bash: ./mychanges.sh: Permission denied
The mychanges.sh script:

Code: Select all

#!/bin/sh
ls -R /mnt/live/memory/changes/home
What am I doing wrong?? :wall:
Last edited by Ed_P on 05 May 2014, 14:50, edited 1 time in total.
Ed

User avatar
Slaxmax
Contributor
Contributor
Posts: 403
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

Re: what am I missing???

Post#2 by Slaxmax » 05 May 2014, 03:34

Code: Select all

guest@porteus:~$ sh mychanges.sh
or
enable your script to executable

Code: Select all

root@porteus:/home/guest# chmod +x mychanges.sh
and run normally

Code: Select all

guest@porteus:~$ ./mychanges.sh
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

User avatar
Ed_P
Contributor
Contributor
Posts: 3212
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: what am I missing???

Post#3 by Ed_P » 05 May 2014, 04:17

Slaxmax wrote:

Code: Select all

guest@porteus:~$ sh mychanges.sh
This works. :good:
or
enable your script to executable

Code: Select all

root@porteus:/home/guest# chmod +x mychanges.sh
Actually I did do this initially.

Code: Select all

guest@porteus:~$ chmod +X mychanges.sh
guest@porteus:~$ ./mychanges.sh
bash: ./mychanges.sh: Permission denied
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 5504
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: what am I missing???

Post#4 by brokenman » 05 May 2014, 14:20

sh mychanges.sh
This works
Wasn't this suggested in an earlier (different) thread?
Actually I did do this initially.
Yes but you used a capital 'X' where the instruction suggested a lower case 'x'

One of the security aspects of linux is that a script must have the executable bit set in order to execute. This is so you can't download something that will run and do something nasty. It is akin to windows making you confirm that you really want to run this executable, only more secure (IMHO). So for future reference after creating a script that you want to call directly, you need to issue: chmod +x myscript.sh

Actually you don't really need the .sh as linux doesn't care about file extensions, but it helps to let YOU know that this is a script.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 3212
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 3.2.2 64-bit ISO
Location: Western NY, USA

Re: what am I missing???

Post#5 by Ed_P » 05 May 2014, 14:49

Image Thank you brokenman.

I just signed on to update this thread with [Solved] and see your posting.

Yes, I figured out that Linux didn't like my capital X and that was my problem. I eventually reran the command with a lower case x and now the script runs normally. Stupid Linux. (Windows doesn't have this uppercase / lowercase problem.)

Yes, preceeding the run command with sh worked and you suggested it in a prior post, but I have a dozen little scripts that I run that don't require the preceeding sh to run and that is why this situation was confusing me. I've experienced the uppercase/lowercase sensitivity of Linux with file names and directory names before but not in a command parameter before and since Windows doesn't have this problem it didn't occur to me. Image And since it was late the eyes were tired.
Actually you don't really need the .sh as linux doesn't care about file extensions, but it helps to let YOU know that this is a script.
Now this idea I like a lot. Image

Thanks again brokenman. :friends:
Ed

Post Reply