0

I'm trying to run a script that uses the select command and I get error below. I'm running the most recent version of ubuntu. Why does it say the commands are not found?

#!/bin/bash
# Scriptname: runit
PS3= "Select a program to execute: "
select program in 'ls -F' pwd date cal exit
do
  $program
done

This is the output:

runit.sh: 3: Select a program to execute: : not found
runit.sh: 4: select: not found
runit.sh: 5: Syntax error: "do" unexpected

1 Answer 1

1

Delete the space after the equal sign:

PS3= "Select a program to execute: "
    ^
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, but now I'm getting: runit.sh: 4: select: not found runit.sh: 5: Syntax error: "do" unexpected Could this be because of what version of bash I have? It says I have GNU bash, version 4.2.8(1)-release (i686-pc-linux-gnu)
@sq1020 It works fine on my laptop with PS3="Select a program to execute: " and GNU bash, version 4.2.10(2)-release (x86_64-unknown-linux-gnu)
@sq1020: make sure that there is no typo or uppercase in the word select

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.