2

How to start sh file in one line command ? This is how I normally start sh file in the specific path

user@user:~$ cd idea-IC-171.4424.56/bin
user@user:~/idea-IC-171.4424.56/bin$ ./idea.sh 

If I would like to start the command in one line like below, I will get error

user@user:~/idea-IC-171.4424.56/bin$ cd idea-IC-171.4424.56/bin/idea.sh
bash: cd: idea-IC-171.4424.56/bin/idea.sh: No such file or directory
John Joe
  • 268
  • Use a ";" to separate your commands – guiverc Jul 20 '18 at 02:47
  • 1
    Honestly depends on your commands and what you are expecting to see. See: https://unix.stackexchange.com/questions/100704/difference-between-executing-multiple-commands-with-and – Terrance Jul 20 '18 at 03:30

1 Answers1

3

Use a ";" to seperate your commands

cd idea-IC-171.4424.56/bin ; ./idea.sh

You could use ./idea-IC-171.4424.56/bin/idea.sh to run it, however the results may be different as if the [shell] script accesses files in the current or relative directory, it won't find them as you didn't cd there before run.

guiverc
  • 30,396