Find the answer to your Linux question:
Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    sourcing a file after redirecting (tcsh)

    Apologies on anything blatantly stupid, I'm still a little new to shell scripting so there are some basic things I'm probably fuzzy on.

    I have written a script that outputs a file with a bunch of aliases. What I want it to do is set those aliases in the same program, but I'm missing some fundamental piece of knowledge that would allow me to do this. While I can source the file from within the program, that clearly does not set the aliases in my current session.

    Basically here's an abbreviated version of my script:
    #!/bin/tcsh -f
    set file = ".$1_$2_aliases"
    echo "## ALIASES FOR $2 ON $1" > $file
    echo "echo SOURCED ALIASES FOR $2 ON $1" >> $file
    echo "alias $3 cd /somedir/$1/somedir/$2/" >> $file
    echo "alias $3 cd /somedir/$1/somedir/$2/somedir" >> $file

    source $file

    How would I make this work so that the aliases actually get set at the end of the program?
    Last edited by stowaway; 02-25-2011 at 04:10 PM. Reason: clarity

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts