Hello fish terminal team!

I have a quick question about a script I am trying to build.

Based on this stackoverflow question,
http://stackoverflow.com/questions/1583219/awk-sed-how-to-do-a-recursive-find-replace-of-a-string

I am building the following fn:

function recursive_replace
  set arg_count (count $argv)
  if [ $arg_count != 2 ]
    echo "expecting two arguments."
    return
  end

  echo replacing $argv[1]
  echo replacing $argv[2]
  find . -type f -print0 | xargs -0 sed -i 's/$argv[1]/$argv[2]/g'
end

However I feel like based on the way fish is structured, perhaps I am
approaching the problem wrong. The above fn doesn't work, because $argv[1]
isn't being textually replaced by it's value when the find command is
executed.

Can someone suggest how I can get this to work? I'm either missing
something in the documentation, or completely clueless how fish is
envisioned to be used.

Thanks!! :)
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to