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?

1

1 Answer 1

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).

1
  • 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
    Commented May 17, 2016 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .