1

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.
Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
3dbeing
  • 11
  • 2

2 Answers2

2

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.

Bruce Barnett
  • 904
  • 5
  • 11
1

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

... | xargs -t0 -I {} tcsh -m -c "<alias> {}"
radical7
  • 8,957
  • 3
  • 24
  • 33