View Single Post
  #1   (View Single Post)  
Old 30th August 2010
Rubiks Rubiks is offline
New User
 
Join Date: Aug 2010
Posts: 1
Default Executing Builtin with xargs issue

System: Mac OS X 10.6.4

Problem - returning history id through History command and passing to xargs results in failure.

My complete line is: history | grep -m 1 -v -e"history" | awk '/open.*25-2010/ {print $1}' | xargs !

Which basically prints out the identifier (12) for the full line of
12 open ~/Documents/log/08-25-2010.rtf

With 12 being passed to xargs "!12" i get the error:
xargs: !: No such file or directory

I've confirmed by leaving xargs blank that it does receive 12, because that's all it prints out.

From my reading it seems like the problem could be executing a shell script (per man history) within a execution utility.

I'd appreciate if anyone can confim my theory, if they can provide more useful things to read on the man pages, or contribute more things to test out.

The reason I'm using this complicated line instead of ctrl+r is that it seems ctrl doesn't allow me to use the same patterns as I want to in awk or grep.
Reply With Quote