Re: How to get argv[0] in alias for bashrc



veg_all@xxxxxxxxx wrote:
any clues how i can get alias to accept the ARGV[0] which is the first
command line argument:

# .bashrc

alias transfer='wget "http://www.$ARGV[0]/temp/transfer.gz";';

When I run it I get:

--22:03:20-- http://www.%5C044argv%5B0%5D/temp/transfer.gz
=> `transfer.gz'
Resolving www.\044argv[0]... failed: Name or service not known.

Under bash, you may want to use function instead of alias to take
arguments..

transfer()
{
wget "http://www.${1?usage: transfer arg0}/temp/transfer.gz"
}

Xicheng

.



Relevant Pages

  • Re: [opensuse] Problem with colours and ls command
    ... Hash: SHA1 ... /etc/csh.cshrc I deleted the lines for ls alias with the colour ... bash: onintr: command not found ... bash: csh.cshrc: line 32: syntax error near unexpected token `set' ...
    (SuSE)
  • csh to bash : chdir
    ... I am converting my csh stuff to bash and have a problem. ... This alias is convenient, it change the cd function so that when I ... change the directory the path shows on the term title and ls command ...
    (comp.unix.shell)
  • Re: OT: the rm bug hit me again
    ... And the -f in the rm command it to stop the "Confirm delete?" ... My rm is set to confirm all deletes using alias. ... the reason is to help prevent those type human errors when you are root ... I personally like the prompt because it reminds me that I am running as ...
    (Fedora)
  • Re: Def alias error in RACF
    ... to define an Alias in a RACF environment with z/OS V1.7 release? ... At the moment to send the request in command line (through the RACF ... Actually, that's a TSO command, not a RACF command. ...
    (bit.listserv.ibm-main)
  • Re: OT: the rm bug hit me again
    ... And the -f in the rm command it to stop the "Confirm delete?" ... That's not a good idea as it teaches you to expect to be prompted, and you'll be bitten badly some time when the alias isn't present. ... the reason is to help prevent those type human errors when you are root ... A user who expects rm to prompt will only delete their own files if it doesn't, a root user who expects rm to prompt can delete the entire system if it doesn't. ...
    (Fedora)