How would you write the equivalent script in fish

#!/bin/bash
for i in `ls`
do
  echo $i
done

Thank you

有帮助吗?

解决方案

fish uses ( parens ) rather than backticks for capturing shell output:

for i in (ls)
  echo $i
end
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top