Re: Bash scripting problems

From: Alexander Dalloz (ad+lists_at_uni-x.org)
Date: 01/08/05

  • Next message: Robert Locke: "Re: scripting rpm installs"
    To: For users of Fedora Core releases <fedora-list@redhat.com>
    Date: Sat, 08 Jan 2005 18:08:31 +0100
    
    
    
    

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

    
    

    -- 
    fedora-list mailing list
    fedora-list@redhat.com
    To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    


  • Next message: Robert Locke: "Re: scripting rpm installs"

    Relevant Pages

    • Re: undelete
      ... How about adding a script named 'rm' that passes the same ... switches to from the script to /bin/rm but moves the files to tmp before ... simply alias rm to that script in bashrc et al. or, ... echo TEST of $0: ...
      (Debian-User)
    • Re: [Full-disclosure] reduction of brute force login attempts via SSHthrough iptables --
      ... Anyhow its no problem at all to modify, so if you dont like it, just dont use it. ... on a lame script like this as long as it WORKS and is not insecure. ... echo "~ sorting out ip by ip" ... # echo "not enough failed logins, probably no attack from: ...
      (Full-Disclosure)
    • Ripping Tapes with Linux--How To
      ... the full script is located in the BASH ... My tape player is a portable style journalist's recorder from the ... The most irritating part of the recording process was setting the ... echo Starting de-noise procedure to file $TMP1 ...
      (comp.os.linux.misc)
    • Re: Linux Backup with Modification Date Filter?
      ... I wrote a bash script that acts as a wrapper to rsnapshot which first ... generates a modification-date filter, ...
      (comp.os.linux.misc)
    • Re: Command Script variable value lost during execution
      ... The value of RC_ver is numeric but ECHO would return it numeric or not... ... I checked ERRORLEVEL at the end of the script and it was 0 but again ... ECHO RoboCopy version xxx%RC_Ver%yyy ... CALL:GetRCVer RoboCopy.exe /Path ...
      (microsoft.public.windows.server.scripting)