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

Re: Bash commands



On Wed, 2005-10-19 at 05:01 -0700, Freddy Freeloader wrote:
> michael wrote:
> 
> >On Tue, 2005-10-18 at 15:49 -0700, Freddy Freeloader wrote:
> >  
> >
> >>Thanks for answering.  Sorry it's taken so long to answer.  I've just 
> >>been too busy to get back to this.  I've inserted my comments in line. 
> >>
> >>michael wrote:
> >>
> >>    
> >>
> >>>On Thu, 2005-10-13 at 08:18 -0700, Freddy Freeloader wrote:
> >>> 
> >>>
> >>>      
> >>>
> >>>>Hi all,
> >>>>
> >>>>I downloaded the Advanced Bash Scripting Guide the other day an have 
> >>>>started to work my way through it.  I'm fairly new to bash so I get more 
> >>>>than a little confused when the output I get is nothing similar to what 
> >>>>the ABS Guide says it should be. 
> >>>>
> >>>>Here is what has me confused at the moment.
> >>>>
> >>>>b=${a/23/BB}
> >>>>
> >>>>echo "b = $b"
> >>>>
> >>>>Now the ABS guide says that where I'm setting b it should be 
> >>>>substituting BB for 23.  It also says that the output of 'echo "b - $b"' 
> >>>>should be: b = BB35
> >>>>
> >>>>However, what I get as output is as follows:
> >>>>
> >>>>ffreeloader@Job:~$ echo "b = $b"
> >>>>b = 
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>if a is unset then that is correct...
> >>>      
> >>>
> >
> >
> >i take it you're agreeing with me that it is printing what you expect 
> >
> >  
> >
> Actually I have no idea why it is printing what it does.  If I knew I 
> wouldn't be here asking about this.   As I said before it doesn't 
> reflect the contents of any one directory on my computer. 

I meant that the first part of the output is as expected... so the bash
stuff is correct. Now we can look at the 'why a listing' part...


> >>>>total 520716
> >>>>drwxr-sr-x  2 ffreeloader ftp        48 2005-10-13 07:50 script
> >>>>-rw-r--r--  1 ffreeloader ftp 532692172 2005-10-12 09:38 server_2003.zip
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>this is a listing of your current directory... 
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>Well, actually I have no one directory that has that exact structure and 
> >>content.  It looks as if the output shows a couple of sub directories 
> >>from my /home directory and a file from another directory that that is 
> >>the default directory for an ftp server. 
> >>
> >>    
> >>
> >>>>Now in my playing around this morning I've been using some command 
> >>>>substitution from the bash prompt that included cd'ing into a directory 
> >>>>that has the files in it that are listed above.  I assume that somehow 
> >>>>setting $b to the value I set it to is calling the history command in 
> >>>>the bash shell and that's how I'm getting this output.  However, I don't 
> >>>>know why or how it works.
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>if you have not editted your .bash* files, re-login afresh and try
> >>>again. the preceeding para implies you may have (inadvertedly) done
> >>>something to, say, .bashrc so it executes something on certain
> >>>conditions and this is where the `ls` output is from.
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>The only editing I have done to any of my .bash* files is to add a 
> >>directory, ~/scripts, to the PATH so I can store all my script writing 
> >>attempts in one directory and execute them without cd'ing there.  That's 
> >>the sum total of my editing.  The ls output is defintely not from that 
> >>directory. 
> >>    
> >>
> >
> >okay, please let us know your PATH and the contents of said ~/scripts
> >
> >ta
> >
> >
> >  
> >
> Hmmm... You're going to assume that I know nothing about the  contents 
> and sub directory structure of the directories on my own computer and 
> what PATH looks like on my computer just because I'm learning bash 
> scripting and have some questions about script output???? 


No. I am double checking. Two pairs of eyes better than one

>  That's more 
> than just a little insulting, 

Wasn't meant to be. Life's too busy to spend time typing in insults!


> but just to show you I know what I'm 
> talking about when I answer direct questions....
> 
> ffreeloader@Job:~/scripts$ ls
> background.sh                log_cleanup.sh      tmout.sh
> commandsep.sh                message.sh          update-java-defaults.sh
> compressdate.sh              position_params.sh  variable_assign.sh
> control_char.sh              scripts_ls.sh       who.sh
> echo.sh                      spam2.py            whowhen.sh
> fileread.sh                  spam.py             wh.sh
> jre-1_5_0_05-linux-i586.bin  system.py
> 
> ffreeloader@Job:~/scripts$ echo $PATH
> /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/ffreeloader/scripts:
> 
> Now, I'll tell you again that the output in question is NOT the contents 
> of any one directory on my computer. 

Well I daren't ask anymore in case you bite my head off...

M



Reply to: