Bash scripting problems

Alexander Dalloz ad+lists at uni-x.org
Sat Jan 8 17:08:31 UTC 2005


Am Sa, den 08.01.2005 schrieb Chadley Wilson um 17:48:

> this is what I get in my script after adding  these two line to the top of the 
> script. I even created a new script with these two caommands and get the same 
> output.
> If I run the command on the command line it works,
> 
> [root at check42 updates]# sh test.sh 
> Starting the update process
> test.sh: line 7: unalias: cp: not found
> test.sh: line 8: unalias: mv: not found
> [root at check42 updates]#

This indicates that no alias for "cp" and "mv" was set when you try to
unalias.

> I am sure there is an environment variable that I have not set,
> what do you think?

> Chadley Wilson

My /root/.bashrc contains by default:

# User specific aliases and functions
 
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i

And when I run following test script it works as expected.

$ cat testsh.sh

#!/bin/bash
 
# echo all aliases set
alias | wc -l
alias | egrep 'cp|mv'
 
# remove aliases for cp and mv
echo ""
echo "unalias cp and mv"
echo ""
unalias cp
unalias mv
 
# echo all aliases set
alias | wc -l
alias | egrep 'cp|mv'

## script end

Alexander


-- 
Alexander Dalloz | Enger, Germany | new address - new key: 0xB366A773
legal statement: http://www.uni-x.org/legal.html
Fedora GNU/Linux Core 2 (Tettnang) on Athlon kernel 2.6.9-1.6_FC2smp 
Serendipity 18:04:15 up 16 days, 19:48, load average: 0.53, 0.32, 0.40 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20050108/98a0ec9d/attachment-0002.bin 


More information about the users mailing list