Solved - Simple script wont run

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
fiddler2500

Solved - Simple script wont run

Post by fiddler2500 »

I have a small file on my desktop called "test.run" and it has the follwoing code in it:
test.run has permission to run as an application.

#!/bin/bash
x=5
y=10
echo "$x and $y"

When I run it in the Console and enter each line by hand, it all works fine (ignoring the shebang line)

However, when I enter "sh test.run", I get:
sh: 0: Cant open test.run

I have also tried this shebang line (#!/usr/bin/env bash) but same result.

Running Mint 13, pretty standrd setup.

Any suggestions

K
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
fiddler2500

Re: Simple script wont run

Post by fiddler2500 »

What an egg.

I was in the wrong directory

Sorry aboit wasting time.

Cheers
K
Locked

Return to “Scripts & Bash”