On Thu, Feb 08, 2018 at 05:51:06PM -0800, Nolan wrote:
On 02/08/2018 05:04 PM, Eduardo Bustamante wrote:
On Thu, Feb 8, 2018 at 4:23 PM, Nolan <4030man@gmail.com> wrote:
I have found a 'result' of a command that cannot be a feature.
Enter command, command executes, prints exit at the prompt.
Goes to next line in terminal showing the "#" prompt.
A "whoami" says root.
Is this known?
Do you need screen captures of my terminal session?
Nolan
What command are you running? Also run: type -a COMMAND_THAT_YOU_ARE_RUNNING
Most likely, you're running something that causes your shell to exit,
and if you logged in as root and then changed to your user, it
explains why you're left at a root owned shell.
I always log in a user, and only change to root as needed.
See the attached screen captures.
I was reading the Bash manual and practicing entering
the commands. Thereby learning them.
If you need anything else just hollow.
Thanks for the reply.
Nolan
ps: the 671 byte file is #1
root@databank:~# su nolan
nolan@databank:/root$ cd ~/bash
nolan@databank:~/bash$ exec < ls.sh
nolan@databank:~/bash$ ls -lA
total 40
-rw-r--r-- 1 nolan nolan 671 Feb 8 01:32 bug_in_bash.\?
-rw-r--r-- 1 nolan nolan 7 Feb 8 01:25 ls.sh
-rwxr-xr-x 1 nolan nolan 156 Feb 7 02:10 myCopy
-rwxr-xr-x 1 nolan nolan 130 Feb 7 02:39 myHello
-rw------- 1 nolan nolan 12288 Feb 7 02:39 .myHello.swp
-rw-r--r-- 1 nolan nolan 74 Jan 29 13:14 test8
-rw-r--r-- 1 nolan nolan 275 Feb 7 02:20 testFile
-rwxr-xr-x 1 nolan nolan 144 Feb 7 02:33 varassign
nolan@databank:~/bash$ exit
root@databank:~# whoami
root
root@databank:~#
nolan@databank:~/bash$ echo ls -lA >> ls.sh
nolan@databank:~/bash$ read < ls.sh
nolan@databank:~/bash$ readline < ls.sh
bash: readline: command not found
nolan@databank:~/bash$ exec < ls.sh
nolan@databank:~/bash$ ls -lA
total 36
-rw-r--r-- 1 nolan nolan 7 Feb 8 01:25 ls.sh
-rwxr-xr-x 1 nolan nolan 156 Feb 7 02:10 myCopy
-rwxr-xr-x 1 nolan nolan 130 Feb 7 02:39 myHello
-rw------- 1 nolan nolan 12288 Feb 7 02:39 .myHello.swp
-rw-r--r-- 1 nolan nolan 74 Jan 29 13:14 test8
-rw-r--r-- 1 nolan nolan 275 Feb 7 02:20 testFile
-rwxr-xr-x 1 nolan nolan 144 Feb 7 02:33 varassign
nolan@databank:~/bash$ exit
root@databank:~# whoami
root
root@databank:~#
Please keep the bug-bash mailing list in your replies.
There's no bug here. You log into the machine as 'root', then 'su' into your
user; then, you run 'exec < ls.sh', which changes the input of the current
shell from terminal input to whatever is in 'ls.sh'. Once the shell consumes
the 'ls.sh' file, it detects the end-of-file, and exits, leaving you at the
'root' shell, where you started.
Also, for general inquiries, use help-bash, not bug-bash.