VMware Communities
BJBear
Contributor
Contributor
Jump to solution

When I run .sh from launcher read -t is listed as illegal option

Several commands in my .sh are not executing properly when I run the .sh from the launcher. But they work just fine when I type the filename.sh in a terminal.

I get errors from illegal option error from

read -t

It is also weird. It also says filename.sh not found. But it is obviously running the the other code within. I am assuming that it is a side effect of the above error.

Code below-

Any ideas?

echo program running

while true; do

     source /usr/bin/other-program-name

     echo Type q to quit

     sleep 1

     read -t .025 -n 1 input

     if [[ $input = "q" ]] || [[ $input = "Q" ]]; then

          #this breaks the loop.

          echo

          break

     fi

done

0 Kudos
1 Solution

Accepted Solutions
BJBear
Contributor
Contributor
Jump to solution

I figured it out.

I needed following as my first line. Couldn't get #! to execute at all before because I left out the env.

#! /usr/bin/env bash

Regards,

View solution in original post

0 Kudos
1 Reply
BJBear
Contributor
Contributor
Jump to solution

I figured it out.

I needed following as my first line. Couldn't get #! to execute at all before because I left out the env.

#! /usr/bin/env bash

Regards,

0 Kudos