Solved

How to Take Input @ Startup Script

Posted on 2008-10-10
8
189 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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 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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now