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

Re: source command puzzle



On Sun, Sep 01, 2002 at 12:47:00AM +0800, csj wrote:
> The following (slightly edited) command sequence should illustrate the
> problem:
> 
> foo:~> echo "backup rescueCD" ; source ${ALTRC_DIR}/tcsh.tar.source ;
> TAR_FULL_RESCUECD_COMMAND                                               
> backup rescueCD
> TAR_FULL_RESCUECD_COMMAND: Command not found.
> foo:~> echo "backup rescueCD" ; source ${ALTRC_DIR}/tcsh.tar.source ;
> TAR_FULL_RESCUECD_COMMAND
> backup rescueCD
> foo:~> alias TAR_FULL_RESCUECD_COMMAND
> ( tar --numeric-owner -lcjvf rescueCD_`date +%Y%m%d`-`date
> +%H%M`.tar.bz2 -C /mnt/rescueCD . > rescueCD_`date +%Y%m%d`-`date
> +%H%M`.tarlist ) > & rescueCD_`date +%Y%m%d`-`date +%H%M`.tarerr
> 
> When I first invoke source to read my alias file and in the same line
> one of the aliases, the shell complains "Command not found". When I
> repeat the same command sequence (or the alias by itself), the alias is
> read correctly.

I imagine that aliases are expanded before running the command.
Therefore your file won't yet have been sourced, and the alias won't be
defined.

You'll have to source the file, hit return, and *then* use the alias.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: