bash scripting problem
hello
if I am typing this into the shell: for names in $(ls *); do cat ./$names ; done I always get an error telling me that the files "ls *" finds, are not existing. if I substitute "cat" with "echo" I get the names printed on the screen as it shoud be. why isnt this working with "cat" for exapmle? tar also doesnt work here. what did I do wrong? thanks raven |
Strange. Your line works for me (Bash version 2.05b.0(1)).
You could aswell run: # for names in $(ls); do cat "./$names" ; done Does the shell command above work? |
maybe your 'cat' is an alias of some strange form of echo and options...
|
to Ztyx:
well i tried your line, and it just wont do what I want it to do. I have bash version 2.05.0(1) to JStew: actually i found two versions of cat on my system, and none of them seemed to me like an alias (i didnt define any) or a link. strangely, both seem to do the same thing, but one is 9k big, the other one 122k (!!!) bothe print the same version, and both dont work. any idea? thanks raven |
Make sure you don't have any subdirectories. The ls * lists the files in the first level of the subdirs and the cat ./$names will fail.
You may try somthing like this: Code:
for i in `ls`; do |
thanks, it works now fine.
raven |
raven: that 'cat' thing (bytes) is weird eh?
|
well. sort of weird :-)
i recompiled the textutils package just for fun and the executable that turned out to be some 30k big... :-) ah well, it works for now :-P thanks for everything guys g, raven |
All times are GMT -5. The time now is 04:01 PM. |