[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash "read" command: want to preload some data



On Sun, Mar 07, 2010 at 21:11:29 -0500, A. Costa (agcosta@gis.net) wrote: 

> Bash isn't strictly needed, plain Bourne shell works, using parameter substitution

[...]

Thank you for you time and trouble.  As it happens, I did in fact
upgrade this lenny box to use bash version 4.1-1 and all is now working
perfectly with the -i option - but thanks again for your efforts.

> (Debian's minimal 'dash' also has a 'read -i', so for
> current Debian, the '-i' is universal.  Earlier versions,
> or other *nixs might not though.)

Not so sure that is correct about dash:

$ apt-cache policy dash
dash:
  Installed: 0.5.5.1-3
  Candidate: 0.5.5.1-3

$ ps -p $$
  PID TTY          TIME CMD
11777 pts/5    00:00:00 dash

$ read -e -p "Enter something:" -i "Default data" data
read: 16: Illegal option -e

$ read -p "Enter something:" -i "Default data" data
read: 17: Illegal option -i

$ read -p "Enter something:" data
Enter something:  

So it seems it understands neither the -e nor -i options (not that it
really matters and TBH it is hardly surprising as dash is supposed to be
very lightweight).

-- 
Bob Cox.  Stoke Gifford, near Bristol, UK.
Please reply to the list only.  Do NOT send copies directly to me.
http://bobcox.com/


Reply to: