shell command
4 posters
Page 1 of 1
shell command
Just write a single shell command without any pipes to list all those files
in the current directory whose filenames are just two characters long.?
in the current directory whose filenames are just two characters long.?
Re: shell command
is this a doubt or jus for knowledge sharing purpose ???
csbhagav- Posts : 3
Join date : 2008-08-18
Re: shell command
the find command is wrong. You need to use "-maxdepth 1" to limit the search to the current directory.
If you only want to look at files, then use "-type f". You main mistake is that the ?? should be inside double quotes.
You want:
find ./ -maxdepth 1 -type f -name "??"
If you have 3 files; aa, bb and cc in the current directory and try to run
find ./ -name ??
You are really entering the command:
find ./ -name aa bb cc
because of file globbing by the shell.
ls ?? will also not work
there is also a very simple command that will do the job ?
If you only want to look at files, then use "-type f". You main mistake is that the ?? should be inside double quotes.
You want:
find ./ -maxdepth 1 -type f -name "??"
If you have 3 files; aa, bb and cc in the current directory and try to run
find ./ -name ??
You are really entering the command:
find ./ -name aa bb cc
because of file globbing by the shell.
ls ?? will also not work
there is also a very simple command that will do the job ?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum