bash - How can I pass each filename to my function? -
I am trying to write a simple function which will allow me to unset the interactive files with the git. Here's what I've done so far:
reset_or_keep () {echo "receive $ 1"} interactive_reset () {local mods = mods = 'git status - republican | Sed -e "s / ^ [A-Z] [\ t] * // g" | However, I get this error: xargs: reset_or_keep: such a file or directory P> I think that reset_or_keep is called once for every entry in the git position - Republican
The easiest way to xargs to #! / Bin / sh reset_core () {resonant "get $ 1"} handle_files () {time of the file's name read; Do reset_or_keep "$ filename" done} git status --porcelain | Sed -e "s / ^ [\ t] * [A-Z] [\ t] * // g" | Handle_files (Note that I had to make a small change in my sed expression to handle the output format from my git status ) Keep in mind that as a -0 flag without xargs , this program will not work properly with filenames that contain white space.
Comments
Post a Comment