bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug-bash


From: Eduardo A . Bustamante López
Subject: Re: bug-bash
Date: Fri, 9 Feb 2018 07:54:11 -0600
User-agent: Mutt/1.9.3 (2018-01-21)

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 <address@hidden> 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

> address@hidden:~# su nolan
> address@hidden:/root$ cd ~/bash
> address@hidden:~/bash$ exec < ls.sh
> address@hidden:~/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
> address@hidden:~/bash$ exit
> address@hidden:~# whoami
> root
> address@hidden:~# 
> 

> address@hidden:~/bash$ echo ls -lA >> ls.sh
> address@hidden:~/bash$ read < ls.sh
> address@hidden:~/bash$ readline < ls.sh
> bash: readline: command not found
> address@hidden:~/bash$ exec < ls.sh
> address@hidden:~/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
> address@hidden:~/bash$ exit
> address@hidden:~# whoami
> root
> address@hidden:~# 

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]