I would like to create a script that navigate to 2 project folder, and execute 2 terminal that remain open, so that I don't have to do it everyday. I tried the following : #!/bin/bash cd Repository/project1/ &amp;&amp; npm run start:debug cd Repository/project2/local &amp;&amp; chmod -x already_made_script.sh  but nothing happen. I did :  Create file with script chmod u+x myscript.sh tried to call the script or double click on it.  what can I fix. Sorry.
121813
I'd like to write a script for opening multiple programs (servers) simultanously in separate terminals - doesn't matter which one - and assign different commands to different terminals with commands "landing" inside the correct terminal. Is this possible? Maybe, something like this:    open terminal1  open terminal2 //simultanously with 1. command1 //execute in terminal1 without opening a new terminal window command2 //execute in terminal2 without opening a new terminal window ...   Can I somehow label terminal windows so commands are executed inside correct terminal?  I'd also like to watch all terminals while their programs are running - my programs have an argument for printing trace/debug to terminal. So I'd like to see what messages are exchanged between them.  NOTE: I'm less concerned about security of exchanged data since this script should serve as a "simulation". I've configured each server to run from an allocated port on localhost.
64012
I have a Python script which I would like to execute at every startup. I can run it by adding this to the startup applications:  python3 /path/to/script.py   That works, but it doesn't open a terminal window, so I can't see the program's output. How could I make it open a terminal window and execute the script in there?  Note: I get the window to stay open with input(' ') at the end of the Python script. Thanks!
98935
I have a sample script (credit goes to ):  #!/bin/bash cat &lt;(cat /etc/lsb-release)   I save this script as somename.sh in my home directory.  Now, I try to open this file in three different ways:  sh somename.sh  bash somename.sh  ./somename.sh   So, I have two questions:   Why are the outputs for the above commands different though they are running the same script?   sh produces a Syntax error bash outputs the desired result ./ gives a Permission Denied error  Why is it necessary to give the script executable permission only when running the script using ./ and not necessary in the other cases?   Thanks in advance!  EDIT: The first part might be similar to the  linked one but, I did have a second question too.
35015
What's the difference between executing a script like this:  ./test.sh  and executing a script like this:  . test.sh?  I tried a simple, two-line script to see if I could find if there was a difference:  #!/bin/bash ls   But both . test.sh and ./test.sh returned the same information.
66951
I have this script:  echo $HOME cd $HOME cd / cd /usr/local/src/   When I run it like this  . script.sh   I get this output:  /home/user : No such file or directory : No such file or directory : No such file or directory   If I run it normally (I added #!/bin/bash before the first line)  sh script.sh   I get this output:  : not found.sh: 2: script.sh /home/user script.sh: 3: Can't cd to /home/user script.sh: 4: Can't cd to / script.sh: 5: Can't cd to /usr/local/src/   The script was run from $HOME directory each time. If I run each command one by one from shell, it executed without problems (invoking cd $HOME from within $HOME simply didn't change directory).  What must I do to make this work?
5666
How can I make a bash script executable by double clicking just like .exe files in Windows? I tried , but there are two consequences:   the terminal twinkles, disappears, and nothing is done. you must specify to run in terminal in order to work.   I have a script that installs tomcat on an offline PC, including all dependencies of tomcat in the script. I need to make the script work on double clicking like windows since most who use the script will not be familiar with Ubuntu.  Forget the above explanation. I want to make a script that can be run by double-clicking on it, without using the terminal. Anybody knows how?
68542
I want to executed command from file (which is script) in current shell in terminal.  Example: I have file ch_dir contains following:  #!/bin/bash cd /usr   Now if I execute file usually as following then it executes commands in different shell:  pandya@pandya-desktop:~$ ./ch_dir pandya@pandya-desktop:~$   Here cd /user is executed in different shell.  But I want to execute in Current shell. How do I do that?  Note: Here cd is only used to explain. Question's aim is to execute any command in current shell
2114
Normally we can source ~/.bashrc file using this command  source ~/.bashrc   but if I write this in a shell script and execute it, nothing happens. Why? Is there any way to do this?  My script:  #!/bin/bash chmod a+x ~/.bashrc source ~/.bashrc   Also tried . (dot) instead of source. Same result.
29800
I just want to write a script which changes my directory.  I put the below commands in the file /home/alex/pathABC  #!/bin/sh cd /home/alex/Documents/A/B/C echo HelloWorld   I did   chmod +x pathABC   In the Terminal, while in /home/alex, I ran ./pathABC, but the output is just HelloWorld and the current directory is not changed.  So what is wrong?
55288
G'day,   I have tried to solve this problem all morning but have not had success. I would like to search for certain scripts in a particular folder and execute them all in parallel. The scripts have different names, but all end with "run.sh". Below what I have tried without success.   The first approach was to use find in combination with -execdir. This works, however, the scripts are executed in a sequantial fashion. I want all scripts to be executed simultaneously (parallel). There seems to be no option to achieve this with -execdir  find . -name "*run.sh" -type f -execdir 'nohup' {} '&amp;' \;   Then, I tried using xargs because there is has a parallel option (-P). I have not tried the parallel option yet, because I am unable to get xargs to run the scripts in their respective subfolders. The commands below execute all scripts, but do that in the folder I am running the command in, therefore the scripts themselves do not work. The scripts have to be executed in their own subfolders. In the above example, -execdir is doing that as opposed to -exec. How do I achieve that with xargs?  nohup find . -name "*run.sh" -type f | xargs -0 -I{} bash -c f\ \{\}   or  nohup find . -name "*run.sh" -type f | xargs -0 -I{} bash -c "f {}"   or  nohup find . -name "*run.sh" -type f | xargs -0 -I{} bash -c "./{}"    I am really frustrated and am hoping that there is somebody out there that can help.  Thank you so much!
84443
Is there a way to create and execute a script file in Ubuntu 14.04?  Perhaps something like Windows batch files.  Specifically, I mean the default scripting language of the Ubuntu terminal (Bash).  How do you make a text file containing bash commands which will be run by the Ubuntu terminal from the top of the file to the bottom.
18999
I have a small script that loops through all files of a folder and executes a (usually long lasting) command. Basically it's  for file in ./folder/*; do     ./bin/myProgram $file &gt; ./done/$file done   (Please Ignore syntax errors, it's just pseudo code).  I now wanted to run this script twice at the same time. Obviously, the execution is unnecessary if ./done/$file exists. So I changed the script to  for file in ./folder/*; do     [ -f ./done/$file ] || ./bin/myProgram $file &gt;./done/$file done   So basically the question is: Is it possible that both scripts (or in general more than one script) actually are at the same point and check for the existance of the done file which fails and the command runs twice?   it would be just perfect, but I highly doubt it. This would be too easy :D If it can happen that they process the same file, is it possible to somehow "synchronize" the scripts?
66272
I'm a web developer. When I want to start working, always i'm executing some command on terminal. For example:  sudo service apache2 start sudo service mysql start sublime   For speed up this process, I create a .sh file which contain these commands.   Now, when I want to start working, I'm just executing this .sh file and all services (mysql, apache2 etc.) starting.   Is it possible to create a custom command for this? For example if I type sudo start-working to terminal, it will execute these commands
97449
I want to write the Ubuntu analogue of a "batch file" (a shell script). But I don't know how to use chmod +x filename command to make it so that the script can be run. Nor do I know where to use it.
95882
I want to be able to "open in terminal" from any directory.  I have the nautilus-open-terminal package installed  I'm not sure what the problem is exactly: when there's only a couple of items in a directory I can just right-click in the empty space, see the context menu, and click "Open in Terminal".  But if there's enough items to create a scroll bar there's nowhere to right click for the current directory.  If I right click on the breadcrumbs I don't see "open in terminal". The same happens when I look at the "File" menu.  This means that if there's a scrollbar there's no way to open a terminal in the current directory - I need to go up a directory, find the directory I was just in, and right click on that to open a terminal.  If there's no way around this it would be just as good to have a key combo to open a terminal in the current directory (ctrl-alt-t opens a terminal in my home directory).  Thanks for your help!   edit: I'm using list view
6980
I would like to execute the shell command "cmatrix" whenever I open a terminal. How to go about achieving this?
64798
When writing answers on here, it's often necessary to create a new script and chmod +x it to make it executable. I won't go into whether this is a good thing or not, but explaining to people that they need to fire in three separate command (and teaching them to use nano!) is a bit of a waffle.  Is there anything easier?