简体   繁体   中英

fish shell for loop oneliner

I'm not sure how to do a for loop using fish shell. I keep having to drop out of fish to run it in bash.

take this for example:

for i in $(cat subdomains); do curl $i | html2text >> websites

I get:

fish: $(...) is not supported. In fish, please use '(cat)'.
for i in $(cat subdomains); do curl $i | html2text >> websites
         ^

Not an answer, but an extended comment.

Links to the relevant documentation:

Note that the command substitution will return a list of values representing each line of the command output. This makes it OK for you to use for line in (cat...) where that would be dodgy in bash.

for i in (cat subdomains); curl $i | html2text; end >> websites

is the answer

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