3dbeing
3dbeing

Reputation: 11

alias in xargs sourcing tcsh

I am trying to run an xargs command that uses an alias. Searching came up with this

alias gojk 'stsq \!:1 | xargs -t -0 -I {} tcsh -c  source ~/.tcshrc.user;myset {}'

but it returns

 Bad ! arg selector

and variations will return

source: too few arguments.

Upvotes: 1

Views: 488

Answers (2)

Bruce Barnett
Bruce Barnett

Reputation: 948

tcsh still evaluates the ! character inside of quotes. You need to put a backslash before it.

I'd suggest you make the tcsh part a script, where you pass it an argument, and get this working. Then call the script using xargs.

Upvotes: 2

radical7
radical7

Reputation: 9124

Use the -m flag to tcsh to have it read your ~/.tcshrc on startup, as in

... | xargs -t0 -I {} tcsh -m -c "<alias> {}"

Upvotes: 1

Related Questions