Script is series of instructions written in plain text file. The script interpreter (i.e. shell, Python, Ruby, etc.) can read this file and act on the instructions as if they were typed at the command prompt. The interpreter also provides a variety of useful programming features to make your scripts ...

learn more… | top users | synonyms (1)

1
vote
2answers
284 views

Shell script does not run when I double click

I have made a shell script (test.sh) on my Lubuntu (15.04) desktop. Permissions are: Only owner (View content + Change content + Execute). When I double click test.sh, I choose "Execute in Terminal". ...
1
vote
2answers
83 views

error while cron scheduling a sh script

This is my shell script which i want to schedule using cron job. parser.sh #!/bin/bash source .profile workon venv cd /home/ashish/deployments/myproject export ...
2
votes
4answers
63 views

Output a list of all file names in a directory with the last 5 characters removed from each

I have a directory that contains files with names, 00004.time, 00010.time, ... There is not pattern except the format, <5 decimal digits>.time I would like to output to a file, just the ...
0
votes
0answers
29 views

How to run a compiled cpp file after booting up the system [duplicate]

I am using an arm v7 soc system which runs ubuntu very well. I can run my compiled cpp file (compiled with g++) perfectly from terminal by ./myproject. However i want code to start automatically ...
1
vote
2answers
27 views

Need my random effects to show the full line

I am working on a script for random predictions and unfortunately instead of the script taking the full lines from the two random lists (Things and Effects) it prints a random word from each. Can ...
0
votes
1answer
35 views

Bash sed to read auth into debconf-set-selections for Vagrant VM

I have a Vagrantfile that uses a bash script to set up a VM. I can't get the script to set a password for MySQL using debconf-set-selections with output from an .auth file. Below is an example of the ...
1
vote
0answers
47 views

Why do I need to restart Ubuntu 14.04 LTS for my networking scripts to work?

When I started using 13.04 LTS on my Virtualbox VM (4.3.26), I turned off network manager and wrote some scripts for dynamically updating the static IP of my laptop on any network. I was doing this ...
0
votes
0answers
56 views

How can I get shebang lines to work in Ubuntu Touch?

If I create a Bash script with a shebang line like #!/bin/bash, make it executable (chmod 755 setup.sh) and then try to run it directly (./setup.sh), I am presented with the following message: bash ...
3
votes
1answer
65 views

What's a good way of protecting password on a plain text executable script?

I am managing a few dedicated game servers on a Ubuntu server 14.04 machine. These games are downloaded and updated by the SteamCMD tool, which for some games, requires login from the command line ...
0
votes
2answers
69 views

Renaming files with a prefix and suffix in folders of varying depths

I have many images of varying extensions (jpeg,jpg,png) contained in many different directories, many of which my be contained in other folders for organizing. Such as: Folder 1/ Folder A/ ...
0
votes
1answer
93 views

Need to automate kill wpa_supplicant on resume on 15.04 with systemd

I need to run sudo killall wpa_supplicant automatically after resume. Unfortunately on 15.04 with systemd it isn't possible with scripts. How this may be automated?
3
votes
2answers
27 views

How to start app or script after system update

I would like to start my script after or during every Ubuntu update. For example: If I make command sudo apt-get upgrade, I want to start my script after successful update. Same if I make update ...
1
vote
2answers
47 views

Help with reminder script in Bash

I have stacked trying to make a simple reminder script which can compare the running date with the date that a file has. for example I have a file that contains: Apr 25 2015 cycling \n Apr 26 2015 ...
2
votes
1answer
225 views

How to automatically answer interactive cli program (not script) with bash script?

I've googled this, and almost all I could find is to answer a bash script and this doesn't work for me. The answers I found told to do: echo "yes" | ./script or ./script <<< yes or ...
1
vote
1answer
30 views

Script that prevents the software to run unless other associate software is already running

I have a situation here. We wanted to prevent a software to run successfully unless the other software is already running. If the script has been run, it run the main software and it will check if the ...
2
votes
4answers
807 views

Bash script to rename files in a directory

I am trying to write a script that takes a directory as a command line parameter and iterates over the files in the directory changing their extension to .bu . I thought this would work but I'm ...
1
vote
1answer
74 views

Running Shell Script on Double Click

Okay, I have opened nautilus and edited preferences to ask when I double click an .sh script to run in Terminal. Well, I don't want to use a .desktop file; I want to just simply double click on the ...
1
vote
3answers
68 views

Commands or script to clean out media folder of unwanted filetypes

I have a media download folder with all sorts of irrelevant files e.g. readme, txt and torrent files in addition to the mp4, avi, mp3 and other valid media files. I want a script or a set of ...
0
votes
0answers
37 views

Execute script on power supply connected

I am looking for a method that will call a script when the power supply is connected, or the battery state becomes "Charging". I will not accept answers involving any type of cron or loops. I know ...
1
vote
1answer
16 views

Need script to display Usage message if non option is chosen from menu

I have managed to get my program to function fine except for posting a usage message should the user attempt a non-menu option. The message that should be displayed if the users enter an incorrect ...
8
votes
7answers
1k views

Exit terminal after running a bash script

I am trying to write a bash script to open certain files (mostly pdf files) using the gnome-open command. I also want the terminal to exit once it opens the pdf file. I have tried adding exit to the ...
3
votes
2answers
147 views

Why putting a script in /etc/cron.hourly is not working?

I put an executable script in /etc/cron.hourly, but that script didn't run every hour actually it never runs at all. Here is the script(Hour-sound) that i made: #!/bin/bash mplayer ...
8
votes
3answers
134 views

How to run a script when a directory is changed by another user?

I know has been a bit of discussion about topics similar to this. But here is what I am basically trying to do. I have a watch directory called watched and whenever a file is added to that directory, ...
0
votes
0answers
11 views

Quick Webhost Script for LAMP - How do I import localhost for www.example.com?

I have the following script written: sudo apt-get update sudo apt-get install apache2 sudo apt-get install apache2 apache2-utils sudo service apache2 restart sudo apt-get install mysql-server ...
0
votes
1answer
19 views

having elevated priority and general @audio permssion in rc.local

I am trying to run jackd instance from /etc/rc.local (along with a few other applications) from a custom made init script. The system is ubuntustudio and I have setup everything to have elevated ...
6
votes
1answer
160 views

What do these commands from a shell script do?

I'm just starting to learn bash. I have the following script, and I would like to know what does the following commands do in order to start to understand a little bit this world. if [ ! -w "." ] ...
-1
votes
1answer
206 views

How to create logfile for a bash script?

I've written a bash script that runs multiple instances of a program and would like to write the entire output of the script to a logfile. I tried #!/bin/bash touch <.../somewhere/logfile.log> ...
1
vote
0answers
27 views

/usr/local/bin/apt-get script being completely ignored

I have added a script to /usr/local/bin/apt-get on an Ubuntu Trusty system which does some checking that is required before launching the "official" apt-get. For reasons I simply cannot comprehend ...
0
votes
2answers
128 views

Enforce a shell script to execute a specific python version

Update. Changing the alias unfortunately does not work. I have changed the alias to alias python='/usr/bin/python2.7' however the shell script still runs the python script in 2.4.3. Muru - I am ...
1
vote
0answers
22 views

Running an Application (xrandr) Script on Startup [duplicate]

I'm running Lubuntu 14.10 with a dual-monitor setup. Since Ubuntu (and its derivatives) don't seem to like monitors with different resolutions (my laptop is 1280x800 and the monitor is 1366x768), I've ...
0
votes
0answers
41 views

upstart .conf script not running at startup

I have a .conf file I run at start up. This file runs a script file i have stored elsewhere. But it does not run. Its supposed to launch node.js and two tabs on firefox. When i launch firefox after ...
2
votes
3answers
178 views

Error when running script in bash

I wrote a script in bash to basically create aliases, but for any reason, it doesn't work in some cases. Here it's the code: #!/bin/bash #Script to create unique and permanent aliases _add_alias() { ...
1
vote
1answer
65 views

How to remove all lines in a file containing a string from another file

I want to remove all lines in a file containing a string from another file. So I don't want to remove the lines which are identical, there are none, but remove all lines if they share a string from ...
0
votes
2answers
51 views

How do I write an awk script that catch ping's time in seconds?

How can I make ping show ms and time in (seconds)? I found this script: $ ping google.com | awk 'BEGIN {FS="[=]|[ ]"} {print $11}' 16.8 16.8 15.7 18.8 How do I write an awk script which brings out ...
5
votes
3answers
284 views

Count down script is not working

I am trying to create a script that will count down to 0 from what ever number I give it. Below is my script and basically nothing happens, no error message, I merely get the standard command line ...
-1
votes
1answer
35 views

How to stop renaming a file which was already renamed using loop in shell script

I have a directory name dir1 containing another directories named 1,2,3,4,5. Now I want to rename directory 1 with 4, 2 => 5, 3 => 6, 4 => 5. but my problem is using mv command in shell script ...
-1
votes
1answer
22 views

different behavior of script when it runs on crontab

I'm trying to write a script that checks if mysql is running, and if not restart it... i get a script to run perfectly if is called manually from terminal, but when i added to crontab it outputs is ...
2
votes
1answer
66 views

sed to execute a command as replacement with substitution pattern as argument

I am trying to replace time in a log file by: cat mlog.log | sed -e "s/^[0-9\.]*/\$(date -d @&)/" Why it always first execute $(date -d $&) but not doing replacement at first and then ...
1
vote
3answers
70 views

Force “bad” (not 0) return code of terminal command?

I have a framework written in python, and for testing purposes I basically want to do a subprocess (aka shell call) ... that should simply come back with a RC != 0. I tried to invoke some non-existing ...
2
votes
3answers
181 views

How to run a bash script after 20 sec on Login?

I want to run a bash script like: #!/bin/bash echo 'cpu limit bomi player at 40%' cpulimit -v -e bomi -l 40 Just 20 seconds after Login into my user. Can you please help me to do that? ...
2
votes
2answers
65 views

Timing limiter for execution of commands in Bash/Shell Script

I have a shell script which looks like this: echo firstOutput read -s command0 command1a command1b command1c echo secondOutput command2 command1a, command1b, command1c are individual commands but ...
4
votes
3answers
297 views

improve bash script

I have a quad core desktop, and i wanted to know the average temprature according to sensors. so i wrote this bash 1 liner. echo `sensors -A | awk {'print $3'} | sed 's/+\|(crit\|0:\|°C//g'` | awk ...
3
votes
1answer
84 views

Create zip files in /var/www/html using crontabs

As the title explains, I'd need to take a file and put it into a zip archive once a day; also, the zip file has to be moved in /var/www/html, where a .php scripts allow users to download it. Assuming ...
1
vote
0answers
141 views

Bash script: command not found

I have an executable script install_packages.sh in /home/etienne/admin folder. The directory's path is added to $PATH variable from /etc/bash.bashrc. When I type #echo $PATH I see that the variable ...
0
votes
0answers
38 views

An Nmap Script and Crontab

I have created a script that will run an Nmap scan, then go through the results and see what is different from past results. Then email the differences. I have been trying to get it to run ...
0
votes
0answers
79 views

How to install firefox addon Skip Cert Error silently through automation

I want to install firefox addon Skip Cert Error to skip ssl error for my automation projects running on Linux virtual hosts. However, I want this installation of add-on to be unattended through some ...
0
votes
2answers
80 views

when ssh is run with a server + command argument, what startup profile runs if any?

I know /etc/profile and ~/.profile are among the start-up scripts used when ssh is used to login to a server – i. e. using ssh with server argument. However, the scenario where I am just using ssh ...
2
votes
2answers
54 views

Writing script for automatic process

My shell is bash and I need to write a script that runs a specific software for each input data in the several folders. For example: gd2p.pl -i /home/WORKDIR/folder1/input1.o Let's say that I have ...
0
votes
1answer
53 views

Alsa unsupported soundcard

I am fairly new to Ubuntu and could really do with some tips, right here is what I want done Bus 003 Device 005: ID 200c:100a Reloop ^the above is my unsupported sound card listed in #lsusb ( ...
17
votes
2answers
832 views

Using “while read…” in a linux script

Could somebody please explain how the following code works? echo '1 2 3 4 5 6' | while read a b c do echo $c $b $a done` Specifically, I'd like to know why the output of this loop is 3 4 5 6 2 ...