xargs
strips single quote mark from input, so if you want pass some data by xargs you will se error:
user:~/$ echo "This is single quote: '" | xargs -I {} echo {}
xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
To do this properly it is necessary to add "-0" parameter:
user:~/$ echo "This is single quote: '" | xargs -0 -I {} echo {}
This is single quote: '
Or use
sed
:
user:~/$ echo "This is single quote: '" | sed "s/'/\\\\'/g" | xargs -I {} echo {}
This is single quote: '
Et voilà!
Brak komentarzy:
Prześlij komentarz