Will display the prompt and take the input just as well.
bakunin
Hi bakunin,
It will with a recent ksh (such as version 93u+). It might with a recent bash, but not with bash version 3.26 (the version included with the latest macOS release) where the following command:
prints no prompt, blocks waiting to read a response, and after a response has been entered gives the diagnostic:
Other shells might do what you want, might print a diagnostic without waiting for input, or might behave in a manner similar to that shown above.
I tend to use an echo or printf to print the prompt before the read, so I get the desired results with any version of any shell that is based on Bourne shell syntax (since the mid 1970's when using echo or since the late 1980's when using printf). But, if you know you only want to run your script on a system where the shell you're using has a built-in read utility with prompting, by all means take advantage of the shortcut.
These 2 Users Gave Thanks to Don Cragun For This Post:
Hi All,
Linux lxs3er06 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:58:04 EST 2007 i686 i686 i386 GNU/Linux
Issue:
While executing shell scripts in bash shell, following error messages are thrown:
rm:command not found
On doing little investigation, I added '/bin' to $PATH and on doing echo... (9 Replies)
PLEASE HELP!
NEED LINUX SCTIPT
Need to write a bash shell script to show information of employees of a department from a company data set.
The script should accept a project number (1/2/3/10/20/30) and output
* the name of the project
* the name of the manager of the controlling... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a bash shell script that presents work information of employees of a department from a company data... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
2. Shell Bash Script
3.
!/bin/bash
if
echo no directory
then
mkdir -p /home/AC_Drywall
elif ; then
echo "$dir already exist"
fi (4 Replies)
Hello,
I am trying to run a shell script that tests the connectivity to all the sftp servers and email if any one of them is down. There are aliases for all the servers with sftp command prefix in a '.alias' file. But when I use the alias name to run it as a command in my shell script to test... (3 Replies)
Hi,
maybe I'm asking a VERY dumb question, but would anybody out there tell me, why this f****** script won't work if executed as a cronjob, but works fine if executed from a shell prompt?
#! /bin/bash
set PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
date >>... (3 Replies)
My shell environment is bash and desktop environment is LXDE. When I use the up and down button on the keyboard to view the command history on bash shell, many times part of the command from the history remains on the line. For example
/home/milhan > ssh somedomain.org
/home/milhan > then when I... (5 Replies)
Migrating Unix batch jobs (Korn Shell) running in HP-UX server to Linux environment.
Hi All
Please help me to understand the easiest way to migrate Kernel Shell scripts to Linux Bash. Also let me know
1. Any automated scripts or tools available for this.
2. Challenges and issues... (5 Replies)
I have a csv file that looks like this
Name,Food,Sport
James,Curry,Gym
Darren,Pizza,Football
Jim,Fish,Hockey
James,Sushi,Tennis
My code looks like this
IFS=","
sed 1d $file_name | while read Name Food Sport
do
mkdir -p $Name
#echo "=================="
#echo "Name: $Name" (3 Replies)