?
Solved

How to Take Input @ Startup Script

Posted on 2008-10-10
8
Medium Priority
?
206 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 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