Hello everyone.
Let's say i have 2 scripts called "fill_cup.sh" and "empty_cup.sh" and i create a 3rd script "cup.sh". How can i run/execute the scripts "fill_cup.sh" and "empty_cup.sh" in the script "cup.sh". I tried with sh fill_cup.sh and ./fill_cup.sh but it doesn't work.

for example

Script cup.sh


echo enter a number

read rep

if test $rep eq 1
#execute the script "fill_cup.sh"
./fill_cup.sh #error: No such file or directory

if test $rep -eq 2
#execute script "empty_cup.sh"
./empty_cup.sh #error: No such file or directory

It gives me "No such file or directory" error
I gave the scripts all the permissions to read write and execute. I also made sure i'm present in the directory where the scripts are located and the run cup.sh but it still gives me the same error when it arrives to ./fill_cup.sh

7 Years
Discussion Span
Last Post by SakuraPink

Seemingly your pwd is not what you think it is.

I thought about that but 200% sure that i'm in the right directory. pwd even shows that i'm in the right directory

edit: funnily it's working now. seems my pwd wasn't what i thought it was but i'm 100% sure that i'm was the right directory. By the way i'm using cygwin on windows and writing the code on wordpad. Don't know if that had any influence on the error.

Thanks all

Edited by mkab: n/a


Just a suggestion I used to work with cygwin I just switched to Putty and it works better! give it a try!

Edited by SakuraPink: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.