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

Re: Bash commands



Freddy Freeloader wrote:
Bill,

No I have not aliased the echo command.
Bill Marcum wrote:

On Thu, Oct 13, 2005 at 08:18:05AM -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 = 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


You haven't aliased the echo command, have you?  Try these commands:
type echo
declare -a
declare -f




Hmm. Here's what I get (blank lines added for clarity)

[jmccarty@Presario-1 jmccarty]$ grep jmccarty /etc/passwd
jmccarty:x:500:500:Mike McCarty:/home/jmccarty:/bin/bash

[jmccarty@Presario-1 jmccarty]$ /bin/bash --version
GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.

[jmccarty@Presario-1 jmccarty]$ alias
alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

[jmccarty@Presario-1 jmccarty]$ \ls -l fred
-rwx------  1 jmccarty jmccarty 27 Oct 14 07:43 fred

[jmccarty@Presario-1 jmccarty]$ cat fred
b=${a/23/BB}
echo "b = $b"

[jmccarty@Presario-1 jmccarty]$ ./fred
b =
[jmccarty@Presario-1 jmccarty]$ . fred
b =
[jmccarty@Presario-1 jmccarty]$

Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!



Reply to: