Post here if you are a new Porteus member and you're looking for some help.
-
Ed_P
- Contributor

- Posts: 7915
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
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??

Last edited by
Ed_P on 05 May 2014, 14:50, edited 1 time in total.
Ed
Ed_P
-
Slaxmax
- Contributor

- Posts: 408
- Joined: 03 Jan 2013, 09:51
- Distribution: KDE4
- Location: Campinas Brazil https://goo.gl/yrxwKi
Post#2
by Slaxmax » 05 May 2014, 03:34
or
enable your script to executable
Code: Select all
root@porteus:/home/guest# chmod +x mychanges.sh
and run normally
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead
Slaxmax
-
Ed_P
- Contributor

- Posts: 7915
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#3
by Ed_P » 05 May 2014, 04:17
This works.
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
Ed_P
-
brokenman
- Site Admin

- Posts: 6104
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
-
Contact:
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.
brokenman
-
Ed_P
- Contributor

- Posts: 7915
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.0 ISO
- Location: Western NY, USA
Post#5
by Ed_P » 05 May 2014, 14:49

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.

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.
Thanks again
brokenman.

Ed
Ed_P