Re: source from within a script

From: Bishara Sabbagh (sabbagh_at_arcor.de)
Date: 06/13/04


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



Relevant Pages

  • Constraining Group Policy
    ... I'm currently trying to rollout outlook 2003 to all of the machines in ... want to have to run the script on the command line for each user. ... The problem is that the user profile doesn't get created until the user ...
    (microsoft.public.windowsxp.security_admin)
  • Re: source from within a script
    ... > of course if I source the shell-script or .profile at the command prompt it ... 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 ...
    (comp.unix.shell)
  • SUMMARY: Sudo from .profile
    ... I wish to run a shell script from a user's .profile file via sudo. ... script is run from the command line, the script executes with no problems, ... and the process started will continue to run when the user logs out. ...
    (SunManagers)
  • Re: usrlogon.cmg hangs
    ... trouble was occurring: ... output of that command and you may be able to see an error ... make sure that the script has "echo on" set. ... >> tried giving this user a new profile? ...
    (microsoft.public.win2000.termserv.clients)
  • Re: Log certain user
    ... > all keystrokes from a certain user into a a file. ... You can use 'script' and enable the command to redirect output to a file. ... If you modify the profile to start this command then you will be able to ...
    (comp.security.unix)