添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hi everyone I'm new to unix and encountered a small problem i couldnt find out a reason why it doesn't work..please help..

in my csh script when i tried to use the foreach loop like this:

foreach x ( ls )
  echo $x

when i tried to run it, it printed out 'ls' to the std out instead of the list of directories in the current directories.

any helpp??

May i know where u have defined/mentioned the directory where u want to do/run ls.

foreach x ( ls )
  echo $x

xbin, thanks for the help. but when i tried each of them they only printed out some of the files in the current directory (yet `ls` and * gave different result :frowning: ), it didnt give me the result as i was using ls .. ?

---------- Post updated at 06:43 PM ---------- Previous update was at 06:39 PM ----------

amit_chopra:

May i know where u have defined/mentioned the directory where u want to do/run ls.

foreach x ( ls )
echo $x

i wrote the loop in a csh script, with #!/bin/csh and run it on bash

---------- Post updated at 06:49 PM ---------- Previous update was at 06:43 PM ----------

ymc1g11:

xbin, thanks for the help. but when i tried each of them they only printed out some of the files in the current directory (yet `ls` and * gave different result :frowning: ), it didnt give me the result as i was using ls .. ?

---------- Post updated at 06:43 PM ---------- Previous update was at 06:39 PM ----------

i wrote the loop in a csh script, with #!/bin/csh and run it on bash

now it works fine. Thanks to both! :smiley: