Re: source from within a script
From: Bishara Sabbagh (sabbagh_at_arcor.de)
Date: 06/13/04
- Next message: Barry Margolin: "Re: source from within a script"
- Previous message: Ed Morton: "Re: compare scriptoutput with an outputfile"
- In reply to: Bob: "Re: source from within a script"
- Next in thread: Barry Margolin: "Re: source from within a script"
- Reply: Barry Margolin: "Re: source from within a script"
- Reply: Bob: "Re: source from within a script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 13 Jun 2004 17:12:40 +0200
Thanks Bob,
of course if I source the shell-script or .profile at the command prompt it
will work, but the problem is how to do that from within the shell-script.
if I use the source scriptname the script would go on forever
and if I append the constucted alias to my .profile file
and source it, the command is not recognised as if the source command was
not executed at all.
Thanks
"Bob" <bob@dont.spam.me> schrieb im Newsbeitrag
news:pan.2004.06.13.14.38.59.459811@dont.spam.me...
> On Sun, 13 Jun 2004 16:22:02 +0200, Bishara Sabbagh wrote:
>
> > Hallo Bob,
> > I tried your script and bash answers : bash: x: command not found
> > that's why I appended the generated alias to .profile and tried to
source
> > it.
>
> Be sure you source the "xxx" script. Use either of the following:
>
> . xxx
> source xxx
>
> Don't execute the script:
>
> ./xxx # NO!
>
> Also, in my script the first line ("#!/bin/bash") is not needed. I just
> put it there by habbit.
>
> <clip>
>
> >> The following works for me...
> >>
> >> #!/bin/bash
> >> echo -n "enter alias... "
> >> read alias command
> >> alias $alias="$command"
> >>
> >> I put the above in a scriped named xxx and used it like this:
> >>
> >> $ . xxx
> >> enter alias... x ls -la
> >> $ x
> >>
> >> the "x" command was properly aliased to "ls -la"
> >>
> >>
> >>
>
- Next message: Barry Margolin: "Re: source from within a script"
- Previous message: Ed Morton: "Re: compare scriptoutput with an outputfile"
- In reply to: Bob: "Re: source from within a script"
- Next in thread: Barry Margolin: "Re: source from within a script"
- Reply: Barry Margolin: "Re: source from within a script"
- Reply: Bob: "Re: source from within a script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|