Post here if you are a new Porteus member and you're looking for some help.
-
Ed_P
- Contributor
- Posts: 8360
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#1
by Ed_P » 05 May 2016, 19:22
On my 486 machine I experienced this today.
Code: Select all
guest@porteus:~$ chmod +x test.sh
guest@porteus:~$ whoami
guest
guest@porteus:~$ test.sh
bash: test.sh: command not found
guest@porteus:~$ ls test.sh
test.sh*
guest@porteus:~$ cat test.sh
#!/bin/sh
if [ `whoami` != "root" ]
then
echo guest
else
echo root
fi
guest@porteus:~$ /home/guest/test.sh
guest
guest@porteus:~$
test.sh doesn't work but /home/guest/test.sh does.
If I specify any script in /home/guest/ bash no longer finds it!!
I have to include the /home/guest/ path before the script's names. I've never had to do that before.
How do I fix this?
Last edited by
Ed_P on 07 May 2016, 16:36, edited 2 times in total.
Ed
Ed_P
-
Bogomips
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Post#2
by Bogomips » 05 May 2016, 19:51
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
Bogomips
-
Ed_P
- Contributor
- Posts: 8360
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#3
by Ed_P » 05 May 2016, 21:01
Thanks
Bogomips. It works but doesn't survive a reboot with my save.dat file.
-update-
Well, maybe it did. But now I get this.
Code: Select all
guest@porteus:~$ test.sh
bash: test.sh: command not found
guest@porteus:~$ sh test.sh
guest
guest@porteus:~$ chmod +x test.sh
guest@porteus:~$ test.sh
bash: test.sh: command not found
guest@porteus:~$ sh test.sh
guest
guest@porteus:~$
Very strange situation. At least for me.
-update-
Using a backup save.dat.
Code: Select all
guest@porteus:~$ test.sh
bash: test.sh: command not found
guest@porteus:~$ sh test.sh
not guest
guest@porteus:~$ /home/guest/test.sh
not guest
guest@porteus:~$ chmod +x test.sh
guest@porteus:~$ test.sh
bash: test.sh: command not found
guest@porteus:~$
Ed
Ed_P
-
Bogomips
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Post#4
by Bogomips » 05 May 2016, 22:49
Try appending it here:
Code: Select all
guest@porteus:~$ cat .bashrc
# Setup color scheme for list call <brokenman>
alias ll='/bin/ls --color=auto -lF'
alias la='/bin/ls --color=auto -axF'
alias ls='/bin/ls --color=auto -xF'
# Append any additional sh scripts found in /etc/profile.d/:
for y in /etc/profile.d/*.sh ; do [ -x $y ] && . $y; done
unset y
# Setup shell prompt for guest <wread and fanthom>
PS1='\[\033[01;36m\]\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] '
PS2='> '
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
Bogomips
-
Ed_P
- Contributor
- Posts: 8360
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#5
by Ed_P » 06 May 2016, 00:38
My file.
Code: Select all
guest@porteus:~$ cat .bashrc
# Setup color scheme for list call <brokenman>
alias ll='/bin/ls --color=auto -lF'
alias la='/bin/ls --color=auto -axF'
alias ls='/bin/ls --color=auto -xF'
# Append any additional sh scripts found in /etc/profile.d/:
for y in /etc/profile.d/*.sh ; do [ -x $y ] && . $y; done
unset y
# Setup shell prompt for guest <wread and fanthom>
PS1='\[\033[01;36m\]\u@\h:\[\033[01;32m\]\w\$\[\033[00m\] '
PS2='> '
guest@porteus:~$
It appears to be the same as yours. And I suspect scripts in your /home/guest/ work normally.
Very strange situation.
Ed
Ed_P
-
Bogomips
- Full of knowledge
- Posts: 2564
- Joined: 25 Jun 2014, 15:21
- Distribution: 3.2.2 Cinnamon & KDE5
- Location: London
Post#6
by Bogomips » 06 May 2016, 01:08
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB
Bogomips
-
brokenman
- Site Admin
- Posts: 6105
- Joined: 27 Dec 2010, 03:50
- Distribution: Porteus v4 all desktops
- Location: Brazil
Post#7
by brokenman » 06 May 2016, 01:33
And I suspect scripts in your /home/guest/ work normally.
/home/guest should never be a part of your $PATH. You will need to add is manually. You can put the file in /usr/bin /usr/local/bin (where all scripts should go) and it will run normally. Alternatively you can prefix the path with ./ if you are in the same directory.
E.g:
./script.sh
or call it with sh:
sh script.sh
How do i become super user?
Wear your underpants on the outside and put on a cape.
brokenman
-
Ed_P
- Contributor
- Posts: 8360
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
Post#8
by Ed_P » 06 May 2016, 16:25
brokenman wrote:Alternatively you can prefix the path with ./ if you are in the same directory.
E.g: ./script.sh
or call it with sh: sh script.sh
Good grief.
Yes, of course, ./ is what I forgot.
http://forum.porteus.org/viewtopic.php?f=123&t=3265
Code: Select all
guest@porteus:~$ test.sh
bash: test.sh: command not found
guest@porteus:~$ ./test.sh
guest
guest@porteus:~$
Thanks, again.
Ed
Ed_P