echo full command to file
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have the following command
echo âÂÂmore PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LSTâ >> NOTNY.sh && chmod 0777 NOTNY.sh
However when I run the command and view the content of NOTNY.sh it contains
âÂÂmore PHONEBOOK.lst
It should contain
more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST
How do I copy the text from the command and not the result I am getting?
bash echo
add a comment |Â
up vote
0
down vote
favorite
I have the following command
echo âÂÂmore PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LSTâ >> NOTNY.sh && chmod 0777 NOTNY.sh
However when I run the command and view the content of NOTNY.sh it contains
âÂÂmore PHONEBOOK.lst
It should contain
more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST
How do I copy the text from the command and not the result I am getting?
bash echo
4
I'm guessing those are "smart" quotes, which your shell saw as just more bytes instead of actual quotes.
â Jeff Schaller
Oct 15 '17 at 22:03
How do I make it see the command as a whole and not evaluate the command?
â John Hamlett IV
Oct 15 '17 at 22:11
2
Quote the string. Your example contains the charactersâÂÂ
andâÂÂ
(U+201C and U+201D) which are not quotes as far as the shell is concerned. The shell understands'
(U+0027) and"
(U+0022). The fancy curly characters featured in your example are just ordinary fancy curly characters.
â AlexP
Oct 15 '17 at 23:11
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have the following command
echo âÂÂmore PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LSTâ >> NOTNY.sh && chmod 0777 NOTNY.sh
However when I run the command and view the content of NOTNY.sh it contains
âÂÂmore PHONEBOOK.lst
It should contain
more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST
How do I copy the text from the command and not the result I am getting?
bash echo
I have the following command
echo âÂÂmore PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LSTâ >> NOTNY.sh && chmod 0777 NOTNY.sh
However when I run the command and view the content of NOTNY.sh it contains
âÂÂmore PHONEBOOK.lst
It should contain
more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST
How do I copy the text from the command and not the result I am getting?
bash echo
asked Oct 15 '17 at 21:49
John Hamlett IV
11
11
4
I'm guessing those are "smart" quotes, which your shell saw as just more bytes instead of actual quotes.
â Jeff Schaller
Oct 15 '17 at 22:03
How do I make it see the command as a whole and not evaluate the command?
â John Hamlett IV
Oct 15 '17 at 22:11
2
Quote the string. Your example contains the charactersâÂÂ
andâÂÂ
(U+201C and U+201D) which are not quotes as far as the shell is concerned. The shell understands'
(U+0027) and"
(U+0022). The fancy curly characters featured in your example are just ordinary fancy curly characters.
â AlexP
Oct 15 '17 at 23:11
add a comment |Â
4
I'm guessing those are "smart" quotes, which your shell saw as just more bytes instead of actual quotes.
â Jeff Schaller
Oct 15 '17 at 22:03
How do I make it see the command as a whole and not evaluate the command?
â John Hamlett IV
Oct 15 '17 at 22:11
2
Quote the string. Your example contains the charactersâÂÂ
andâÂÂ
(U+201C and U+201D) which are not quotes as far as the shell is concerned. The shell understands'
(U+0027) and"
(U+0022). The fancy curly characters featured in your example are just ordinary fancy curly characters.
â AlexP
Oct 15 '17 at 23:11
4
4
I'm guessing those are "smart" quotes, which your shell saw as just more bytes instead of actual quotes.
â Jeff Schaller
Oct 15 '17 at 22:03
I'm guessing those are "smart" quotes, which your shell saw as just more bytes instead of actual quotes.
â Jeff Schaller
Oct 15 '17 at 22:03
How do I make it see the command as a whole and not evaluate the command?
â John Hamlett IV
Oct 15 '17 at 22:11
How do I make it see the command as a whole and not evaluate the command?
â John Hamlett IV
Oct 15 '17 at 22:11
2
2
Quote the string. Your example contains the characters
âÂÂ
and âÂÂ
(U+201C and U+201D) which are not quotes as far as the shell is concerned. The shell understands '
(U+0027) and "
(U+0022). The fancy curly characters featured in your example are just ordinary fancy curly characters.â AlexP
Oct 15 '17 at 23:11
Quote the string. Your example contains the characters
âÂÂ
and âÂÂ
(U+201C and U+201D) which are not quotes as far as the shell is concerned. The shell understands '
(U+0027) and "
(U+0022). The fancy curly characters featured in your example are just ordinary fancy curly characters.â AlexP
Oct 15 '17 at 23:11
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
Instead of âÂÂsmartâ quotes, use normal "double-quotes":
printf "%sn" "more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, saving a pointless call to more
, since awk will read the files you tell it to:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, since the second sort
will just override the first one:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Instead of âÂÂsmartâ quotes, use normal "double-quotes":
printf "%sn" "more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, saving a pointless call to more
, since awk will read the files you tell it to:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, since the second sort
will just override the first one:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
add a comment |Â
up vote
1
down vote
Instead of âÂÂsmartâ quotes, use normal "double-quotes":
printf "%sn" "more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, saving a pointless call to more
, since awk will read the files you tell it to:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, since the second sort
will just override the first one:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Instead of âÂÂsmartâ quotes, use normal "double-quotes":
printf "%sn" "more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, saving a pointless call to more
, since awk will read the files you tell it to:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, since the second sort
will just override the first one:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Instead of âÂÂsmartâ quotes, use normal "double-quotes":
printf "%sn" "more PHONEBOOK.lst | awk '!/ NY /' | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, saving a pointless call to more
, since awk will read the files you tell it to:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k1 | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
Or, since the second sort
will just override the first one:
printf "%sn" "awk '!/ NY /' PHONEBOOK.lst | sort -k4 | tee PHONENOTNY.LST" >> NOTNY.sh && chmod 0777 NOTNY.sh
edited Oct 16 '17 at 21:49
answered Oct 15 '17 at 23:17
Jeff Schaller
32.1k849109
32.1k849109
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398290%2fecho-full-command-to-file%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
4
I'm guessing those are "smart" quotes, which your shell saw as just more bytes instead of actual quotes.
â Jeff Schaller
Oct 15 '17 at 22:03
How do I make it see the command as a whole and not evaluate the command?
â John Hamlett IV
Oct 15 '17 at 22:11
2
Quote the string. Your example contains the characters
âÂÂ
andâÂÂ
(U+201C and U+201D) which are not quotes as far as the shell is concerned. The shell understands'
(U+0027) and"
(U+0022). The fancy curly characters featured in your example are just ordinary fancy curly characters.â AlexP
Oct 15 '17 at 23:11