Platforms : Solaris 10 and RHEL 5.6
I always get double quotes , single quotes and asteriks mixed up for find, ls and grep commands.
The below commands retrieve the correct results. But , unders stress , I get all these mixed up :mad: .So, i wanted to get a clear picture.
Please check if my assumptions mentioned below are correct. The below tests are conducted in Solaris 10
I. find Command
For find command, the wildcard character is asterik and it should be enclosed in double quotes.
II. grep Command
For grep, the wildcard character is asterik and it should be enclosed in single quotes.
III. ls Command
For ls command, wildcard character is again asterik, but don't use single quotes or Double quotes.
I always get double quotes , single quotes and asteriks mixed up for find, ls and grep commands.
The below commands retrieve the correct results. But , unders stress , I get all these mixed up :mad: .So, i wanted to get a clear picture.
Please check if my assumptions mentioned below are correct. The below tests are conducted in Solaris 10
I. find Command
For find command, the wildcard character is asterik and it should be enclosed in double quotes.
Code:
$ touch KLS.dmp
$
$
$
$ find ./ -name "K*.dmp" 2> /dev/null
./KLS.dmp
$
$
$
$
$ find ./ -name "K*.dmp*" 2> /dev/null
./KLS.dmp
-- Single quotes work too
$ find ./ -name 'K*.dmp*' 2> /dev/null
./KLS.dmp
For grep, the wildcard character is asterik and it should be enclosed in single quotes.
Code:
$ echo "blue skies" > MyFile.txt
$
$
$ cat MyFile.txt
blue skies
$
$
$ grep blu* *.txt
blue skies
$
$
$ grep 'blu*' *.txt
blue skies
For ls command, wildcard character is again asterik, but don't use single quotes or Double quotes.
Code:
$ ls -alrt M*
-rw-r--r-- 1 oracle oinstall 11 Nov 13 11:37 MyFile.txt
$
$
$
$ ls -alrt "M*"
M*: No such file or directory
$
$ ls -alrt 'M*'
M*: No such file or directory
$