Solved

How to Take Input @ Startup Script

Posted on 2008-10-10
8
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

687 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