Skip to main content
deleted 337 characters in body
Source Link
Mitms
  • 159
  • 1
  • 2

For passing output as an argument, I tend to use a while loop since I'm not familiar with xargs.

ls | grep '^Dar' | while read line; do rm "$line";done; 

Edit:

While still often using the above to process the output of one command into the argument of another command. I have familiarized myself somewhat with xargs:

Would ls be returning [a, b, c] then #> ls | xargs rm is equivalent to #> rm a b c. This might yield unexpected results due to possible spaces in the arguments.

For passing output as an argument, I tend to use a while loop since I'm not familiar with xargs.

ls | grep '^Dar' | while read line; do rm "$line";done; 

Edit:

While still often using the above to process the output of one command into the argument of another command. I have familiarized myself somewhat with xargs:

Would ls be returning [a, b, c] then #> ls | xargs rm is equivalent to #> rm a b c. This might yield unexpected results due to possible spaces in the arguments.

For passing output as an argument, I tend to use a while loop since I'm not familiar with xargs.

ls | grep '^Dar' | while read line; do rm "$line";done; 
added 328 characters in body
Source Link
Mitms
  • 159
  • 1
  • 2

For passing output as an argument, I tend to use a while loop since I'm not familiar with xargs.

ls | grep '^Dar' | while read line; do rm "$line";done; 

Edit:

While still often using the above to process the output of one command into the argument of another command. I have familiarized myself somewhat with xargs:

Would ls be returning [a, b, c] then #> ls | xargs rm is equivalent to #> rm a b c. This might yield unexpected results due to possible spaces in the arguments.

For passing output as an argument, I tend to use a while loop since I'm not familiar with xargs.

ls | grep '^Dar' | while read line; do rm "$line";done; 

For passing output as an argument, I tend to use a while loop since I'm not familiar with xargs.

ls | grep '^Dar' | while read line; do rm "$line";done; 

Edit:

While still often using the above to process the output of one command into the argument of another command. I have familiarized myself somewhat with xargs:

Would ls be returning [a, b, c] then #> ls | xargs rm is equivalent to #> rm a b c. This might yield unexpected results due to possible spaces in the arguments.

Source Link
Mitms
  • 159
  • 1
  • 2

For passing output as an argument, I tend to use a while loop since I'm not familiar with xargs.

ls | grep '^Dar' | while read line; do rm "$line";done;