user637965
user637965

Reputation:

bash select command

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

Upvotes: 0

Views: 2318

Answers (1)

John Kugelman
John Kugelman

Reputation: 361655

Delete the space after the equal sign:

PS3= "Select a program to execute: "
    ^

Upvotes: 1

Related Questions