Read: line 6: illegal option -e


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read: line 6: illegal option -e
# 1  
Old 11-15-2012
Read: line 6: illegal option -e

For some reason read -e isn't working in my script. I need a directory as input from a user and I'd like for them to be able to use tab complete which is why I'm using -e. When the script is run, I get:

read: line 6: illegal option -e

In order to just figure out what is going on with the -e option I made a small test script that gives the error:

Code:
#!/bin/bash

set -e

echo "This is a test."
read -e dir

echo $dir

Anyone know why I would be getting the illegal option -e?

or is there another way to get tab complete for the user input?
# 2  
Old 11-15-2012
Specifically, which operating system are you using? Exactly how are you invoking the script? What is the mode (file permissions) of the script file?

Regards and welcome to the forum,
Alister
# 3  
Old 11-15-2012
when I run /proc/version I get:

Linux version 2.6.31.8 (@) (gcc version 4.3.2 (sdk3.3-ct-ng-1.4.1) ) #1 Tue Jul 24 18:11:21 PDT 2012

I've done a chmod 777 and a chmod +x to the file.

and to run it I've tried:
./test.sh
sh test.sh
bash test.sh

all resulting in the same error.

---------- Post updated at 05:30 PM ---------- Previous update was at 11:59 AM ----------

Nobody has any ideas?

Is there another way to get tab complete to work with the user input without "-e"?
# 4  
Old 11-15-2012
Can you change set -e on line 3 to set -x and post the output.
# 5  
Old 11-15-2012
You may have an old version of bash which doesn't support -e.

And, no.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

stat -c illegal option

I'm trying to get the size of each file, but when I try to use stat -c %s <file> I get the message stat: illegal option -- c Also, the man page for stat shows readlink,stat. It doesn't seem to match the man pages I've seen online. what is going on here? (6 Replies)
Discussion started by: nextyoyoma
6 Replies

2. Shell Programming and Scripting

date: illegal option -- d in sun solaris

Hi all, I am trying to execute the following command in a sun solaris machine and getting the error as below. bash-2.03$ date -d "1 day ago" +%Y%m%d date: illegal option -- d bash-2.03$ uname -a SunOS gtrd02 5.8 Generic_117350-55 sun4u sparc SUNW,Sun-Fire-V440 Can anybody help me to... (1 Reply)
Discussion started by: Tuxidow
1 Replies

3. Shell Programming and Scripting

Help needed sed: illegal option -- i

hello. i have a script, but in solaris i get this message sed: illegal option -- i whats wrong? With Ubuntu there is no problem. Thanks for help. #!/bin/bash for file in $(find /directory..../Test/*.txt -type f) do head -n 1 $file | egrep '^#!' if then sed -i '2i\Headertext'... (3 Replies)
Discussion started by: fertchen
3 Replies

4. Solaris

date -d illegal option in Solaris

Hi All, Is it possible to run date -d option in Solaris? Do we have a work around so that -d option will be recognized by solaris as it is recognized by linux. I need this since i am using this in scripting and it works in Linux box. my problem is it doesn't work in solaris box. ... (6 Replies)
Discussion started by: linuxgeek
6 Replies

5. Solaris

Please help --setfacl: illegal option -- R

when i am executing setfacl -Rm u:ggoyal2:rwx,m:rwx dir i am getting error bash-3.00# setfacl -Rm u:ggoyal2:rwx,m:rwx dir setfacl: illegal option -- R usage: setfacl -f aclfile file ... setfacl -d acl_entries file ... setfacl -m acl_entries file ... setfacl -s acl_entries file... (2 Replies)
Discussion started by: manoj_dahiya22
2 Replies

6. UNIX for Dummies Questions & Answers

UNIX chauthtok(): illegal module option

Hi all, I just implemented PAM on my Solris 8/9 boxes and one of the entries I have got in the /etc/pam.conf is as followed, other password required pam_unix.so nullok remember=7 md5 shadow use_authtok However, once I set this and the following meesages appears in /var/adm/messages... (1 Reply)
Discussion started by: stancwong
1 Replies
Login or Register to Ask a Question