简体   繁体   中英

how to use `amp;` & `gt;` commands in linux-shell?

i downloaded a script from Internet. when i run it, it stops because of && command and says No command 'amp' found

what is amp ? what is gt ? what does they do?

I suspect this has undergone an HTML entity translation. You want to reverse this eg

& becomes &

and

> becomes >

So (for example)

cd /dir && ls > filename

would become

cd /dir && ls > filename

&amp and &gt are html escape codes for & and > respectively.

Either you have downloaded a script that has been htmlized, or you've accidentally downloaded a webpage with the script on.

Check the top line of the file. if it starts with something like #!/usr/bin/bash then it's the former and you just need to reverse the changes. If it has something like a <html> tag as the start, then you've downloaded the webpage - go back to where you got it and look for something like a 'raw' link

in other word, &amp; is the character reference for "An ampersand". While gt is simply we call it as (greater than).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM