Write a shell script to list only the hidden files in the current directories? What is the o/p of following command $a =*, echo $a, echo "$a"? Which of the following is allowed in an arithmetic involving expr instruction. [],{},()? If values "hi", "Hello","Bye","Good Bye" are supplied to the following statement what will be the o/p read n1,n2 , echo $n1 $n2? How do you know that how many commands can be stored in the buffer in one session?

Questions by udaybond   answers by udaybond

Showing Answers 1 - 17 of 17 Answers

lakshmi

  • Sep 15th, 2006
 

I think both may be same as *

  Was this answer useful?  Yes

Mukund

  • Sep 18th, 2006
 

Hi,

For 2.. echo $a lists all the files in current directory, where as echo "$a" prints *.

  Was this answer useful?  Yes

Chintan

  • Sep 26th, 2006
 

Question: Write a shell script to list only the hidden files in the current directories!

Answer: 

ls -A | grep ^[.] Works on Linux
ls -a | grep ^[.]
ls -la | grep -v ^d | awk {'print $9'} | grep ^[.]

  Was this answer useful?  Yes

Question: Write a shell script to list only the hidden files in the current directories.
Answer: ls -A | grep ^[.] Works on Linux
 ls -a | grep ^[.]
 ls -la | grep -v ^d | awk {'print $9'} | grep ^[.]

  Was this answer useful?  Yes

How do you know that how many commands can be stored in the buffer in one session?
Answer: type "env" command on the prompt and check HISTORY or BUFFER or HISTSIZE value

  Was this answer useful?  Yes

Chiranjeevi Manne

  • Mar 25th, 2007
 

ls -al | grep '^.'

  Was this answer useful?  Yes

anand

  • May 9th, 2007
 

command $a =*, variable 'a' will have all the files and directories in the current location.. simply the result of "ls".
echo $a - this will give the list of files and directories
echo "$a" -  this wil show value assinged to a.. ie., *

  Was this answer useful?  Yes

raj

  • May 17th, 2007
 

You can get them by just giving
ls -ax | head -2

  Was this answer useful?  Yes

Markerhell

  • Aug 26th, 2009
 

1. ls > a.txt | ls -a > b.txt | diff a.txt b.txt

2. echo $a will print the list of all the files in the directory in row manner.
    echo "$a" will print * on the o/p window as it will be considered as variable only.

3. In arithamtic expr [] is used

4. The output will be "hi Hello"

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions