Solved

How to Take Input @ Startup Script

Posted on 2008-10-10
8
194 Views
Last Modified: 2013-12-26
Hi There,

It didn't create input to enter home directory. Drive me nut?

clear
dir=/h/users/alex/bin
while ["$dir" != "home"]
do
  echo "Enter location of your home directory: "
  read input
  echo "$input: This is your home directory"
done  
0
Comment
Question by:suredazzle
  • 3
  • 3
  • 2
8 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 22690397
do you mean:

clear
dir=/h/users/alex/bin
while ["$dir" != "home"]
do
  echo "Enter location of your home directory: "
  read dir
  echo "$dirt: This is your home directory"
done
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22690404
Sorry typo


clear
dir=/h/users/alex/bin
while ["$dir" != "home"]
do
  echo "Enter location of your home directory: "
  read dir
  echo "$dir: This is your home directory"
done
0
 
LVL 48

Expert Comment

by:Tintin
ID: 22690471
Your while test has a syntax error.  It needs spaces, ie:
while [ "$dir" != 'home' ]

Open in new window

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Author Comment

by:suredazzle
ID: 22690485
Hi Omar Farid,

That's what the script suppose to say.

Do you have better suggestions?
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22690553
I could not understand what you want to do with the script
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 22690622
Please describe what you want your script to do and what is not working for you at the moment.
0
 
LVL 1

Author Closing Comment

by:suredazzle
ID: 31505177
Hi Omar Farid & Tintin,

Thanks! Fix the error. Need to apply brain surgery to write more. I know what it should look like. Need to play more. :)
0
 
LVL 1

Author Comment

by:suredazzle
ID: 22694993
Hi,

I want to create non-existence directory. Please advise solutions. Thanks.

clear
echo "Enter location of your home directory : "
read input

if [[ ! -d ~/h/susan ]] && echo "Directory ($input) does not exist."
   echo "Creating now....."
   mkdir -p ~/h/susan
   echo
else
echo "This is your home directory"  
fi

<<OUTPUT
Enter location of your home directory :
/h/susan
./test.sh: line 12: syntax error near unexpected token `else'
./test.sh: line 12: `else'
OUTPUT
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question