linux – Bash Script terminates when shell terminal is closed

I’m able to successfully run the script below from a terminal in ubuntu 14.04. However, when I close the terminal the vlc process also terminates which I don’t want. I’ve tried using “&” so that it runs in the background, but to no avail ( &). Any suggestions on how to run the script below so that if the terminal is closed, the vlc process does not terminate? Any suggestions would be appreciated.

vlc --extraintf telnet localhost 4212 --vlm-conf /home/test/Videos/temp.vlm

bash – shell script removing quotes when using sed

I’m trying to change a line of syntax in a config file where the line looks like the following:


I’m writing a script that would require input the user to change the ip and keep the same format as above. What I wrote:

echo “enter IP”
read inputIP
sed -i /host=/chost=”$inputIP” /path/file.xml

What I get when i run this in file is: host=

So the question is how do I run this and not lose the quotes?

bash – Creating script to cp directory multiple times

I have a directory called ds1. I am trying to copy it 4 times so I also have ds1 ds2 ds3 ds4 and ds5.

I am able to use the following command from the terminal and it works

for i in {2..5}; do cp -r /home/test/DeepSight/DeepSight-Instance1 "DeepSight-Instance$i.txt"; done

However, when I enter it into a script like this


for i in {2..5}; do cp -r /home/test/DeepSight/DeepSight-Instance1 "DeepSight-Instance$i.txt"; done

It creates one directory named ds{2..5} instead of the directories with increments between 2 and 5. Not understanding what I’m doing wrong.

urlencoding – Como codificar una URL (urlencode) en un script de bash?

Estoy generando un script que solicita datos de un usuario,
luego estos datos se deben enviar en formato de URL (url-encoded) a otro script.

echo -n "Search: "
./searchcommand $URLENCODED_VALUE

Existe un comando estandar que pueda realizar esto?

He probado el siguiente codigo:

URLENCODED_VALUE=$(echo "$SEARCH" | sed -e 's/%/%25/g' -e 's/ /%20/g' -e 's/!/%21/g' -e 's/"/%22/g' -e 's/#/%23/g' -e 's/$/%24/g' -e 's/&/%26/g' -e 's/'''/%27/g' -e 's/(/%28/g' -e 's/)/%29/g' -e 's/*/%2a/g' -e 's/+/%2b/g' -e 's/,/%2c/g' -e 's/-/%2d/g' -e 's/./%2e/g' -e 's///%2f/g' -e 's/:/%3a/g' -e 's/;/%3b/g' -e 's//%3e/g' -e 's/?/%3f/g' -e 's/@/%40/g' -e 's/(/%5b/g' -e 's/\/%5c/g' -e 's/)/%5d/g' -e 's/^/%5e/g' -e 's/_/%5f/g' -e 's/`/%60/g' -e 's/{/%7b/g' -e 's/|/%7c/g' -e 's/}/%7d/g' -e 's/~/%7e/g') 

Funciona, pero creo que debe haber algo mas sencillo, que sea mas general (pueden haber casos no cubiertos) y que no requieraun codigo tan largo o librerias/imports adicionales.

La idea es entregar un valor como K7@e49:b234 y obtener K7%40e49%3Ab234.

windows – Open PHP Storm on bash command-line without output

Since hours I’m trying to run my phpstorm from commandline, without having any output at all.


Every day when I come to work, I have multiple tools to start… 2 different vagrant machines, phpstorm etc.

To keep it fast an simple, I decided to create a script doing all this for me…

So after my vagrant’s are started, I want to start phpstorm. But no matter what I do, I allways have a prompt in my console.

If I run it like

cmd.exe /c /B "/C/Program Files/JetBrains/PhpStorm 2019.2.2/bin/phpstorm64.exe"

It calls the exe file but stops for some reason saying: could not open files/JetBrains.... This error comes from phpstorm, whats actually wired since it obviously starts it đŸ˜€

How ever, calling the programm like

"/C/Program Files/JetBrains/PhpStorm 2019.2.2/bin/phpstorm64.exe"

Opens PHPStorm, but blocks my console… if I hit CTRL+C to unlock console, storm is closing.

Running it with a & at the end like

"/C/Program Files/JetBrains/PhpStorm 2019.2.2/bin/phpstorm64.exe"&

Runs the program, locks the console, hitting CTRL+C unlocks console, program stays open but still prompting to my console… May im to stupid to google… but I can’t find a solution.
Goal is to have a script that starts the tool an keeps the console clean to do some other work.

Anyone knows how to solve this?

My Setup:

cmder.exe (Console Emulator)

Git Installed (So base is mintty.exe)

terminal – Circumventing Apple developer permissions for bash script

I’m sending a bash script as a .command file to a friend. This person is not very tech savvy which is why I’m sending it in the first place, the goal is for the .command file to run through the shell operations for them. However when the attempt to run the script they get the run.command is damaged and can't be opened. You should move it to the Bin error. I believe this is a new version of the old unsigned developer prompt as apple is blocking out random code from their systems. Anyway I can have this run without too much complexity?

Edit: I’m open to using applescript if this one alleviate the issue.

bash script for finding missing files which have variable gaps

I have folders with several PNG files like


so when c5-c8 remain the same, c9-c12 increase of 16. But after a number of files also c5-c8 change.

Is it possible to create a script checking for missing files? For example, after
pic_192722961.png I should have

linux – Bash Shell, How to create tar.gz without folder structure

I have a folder that I want to gzip on /root/sample/tobegzip/ I want to create and save on the same folder as /root/sample/

I do use below command on my script

tar -cvzf /root/sample/tobegzip.tar.gz /root/sample/tobegzip/

It works;

However, when I untargzip it comes with additional folders as /root/sample/tobegzip/root/sample/tobegzip/

Can I create tar gzip archive without preserving directory structure?

PS: It needs to work with a shell script so I need full path when I gzip.

Thank you,

beginner – Bash File system

This is a Bash script that runs commands which builds code using the parameters given.


The task:

I have multiple instances of websites which need to be build individually using individual yarn commands and then copied out of a build folder and placed into their own individual folder. I found this very repetitive and so I wanted to solve the problem using a script. I thought about using Python but I ended up using Bash.


Inputs: folder where the code is built, folder where the output code is stored, list of languages to run yarn build on.
For each language in input:
   Go to project/build
   Run "yarn build_language"
   Delete output/language folder
   Copy project/build to output/language folder

Here is my Bash implementation:


# PROC Build and Copy:
#     Args:
#         1) Build directory
#         2) Output directory path (general)
#         3) List of language names

#     For each lang in list of language names:
#         Run appropriate build command
#         Delete output directory
#         Copy build directory to output directory/lang

if (( $# < 3 )); then
    echo "Please use at least 3 parameters"
    exit 2


readonly build_path=$1
readonly output_path=$2

build_command="yarn build_"

for lang in "${languages(@)}"
    cd "$build_path" || exit
    eval "${build_command}${lang}"
    cd ~- || exit
    rm -rf "$output"
    mkdir -p "$output"
    cp -r "$build_path" "$output"

Sample usage: ./ my_project/build/. environments/ python lua


I found a style guide on Github and tried to follow it but this is my first Bash script so I am not sure if I followed a good style. I am a Python developer and I fear I may have written a Python-script in Bash. I am also not sure if Bash is the best way to implement this type of script. I wanted to make this re-usable by pulling the directories out into parameters, but I decided not to have the yarn command as a parameter as I thought it could be confusing having lots of parameters. Are my assumptions justified, or do they make the code confusing?

Remotely monitoring bash terminal progress

I’m thinking of creating a system which would help me transfer the output of my bash terminal to an app in a remote device(like my Android smartphone).

I was thinking of tackling this problem as just a read and write problem on two ends of a Socket with the Server running in my machine and Client in my phone. But the problem I ran into was that my devices can be on different networks. In that case, do I have to implement something like port-forwarding? Is there a better approach to this which will require minimal effort as a user who doesn’t know much about networking and how to set up port-forwarding?