How can do this?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can do this?
# 1  
Old 05-19-2011
How can do this?

How can Takes exactly one argument, a directory name in ubuntu terminal?
# 2  
Old 05-19-2011
huh??
# 3  
Old 05-19-2011
Do you mean
Quote:
How do I read an argument into my shell scirpt and ensure that it is a readable directory before I continue processing?
if so, try
Code:
if  [  "X$1" != "X"  -a -d $1 -a "X$2" == "X" ] ; then
   #proceed to process the directory
else
    echo "Usage: $0 <directory name>"
fi

# 4  
Old 05-19-2011
Quote:
Originally Posted by Skrynesaver
Code:
if  [  "X$1" != "X"  -a -d $1 -a "X$2" == "X" ] ; then

You can try if [ ${#} -eq 1 -a -d $1 -a -r $1 ]; then
# 5  
Old 05-19-2011
Quote:
Originally Posted by danmero
You can try if [ ${#} -eq 1 -a -d $1 -a -r $1 ]; then

no I mean
like this

echo "enter your name"
read name


# now i when start shell script it ask me to enter my name right?
so when i enter my name for example COME TO LOVE
i want from shell script save my name enter onther file like test.txt

how can i do that or what command must add it to get this file?
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question