1

I'm trying to write a one liner that sources aliases, then calls one of those newly sourced aliases. My one liner is basically:

alias startEnv sourceAliasFile;runNewAlias

Since I'm using csh, I can't make a function. When I run this, my source executes but my new alias doesn't exist yet and does not execute. Why does this not work and is there a way to get around it?

techraf
  • 5,941
Malik
  • 11
  • I think this post answers the question: http://unix.stackexchange.com/questions/240274/new-alias-not-available-after?rq=1 –  Aug 07 '16 at 00:16

1 Answers1

1

It doesn't work because the alias definition and use are all on one line. You might work around this by writing the alias definition to a temporary file and sourcing that. But aside from that — you need to have the statements on separate lines (semicolons don't count for the parser in this case).

Thomas Dickey
  • 76,765
  • It's an interesting one, because doing alias foo ls; alias shows that foo is aliased to ls, so CSH knows that the alias has occurred...(on FreeBSD 10.3) – forquare May 17 '16 at 08:25