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)

6
votes
3answers
534 views

How do I add a program that must be run from within its own directory to the panel or main menu?

Some programs can only be run from within their own directories. If I go to System --> Preferences --> Main Menu --> Add Item and select the file, it will not work. Similarly, if I right ...
6
votes
3answers
4k views

How to completely restart script from inside the script itself

I'm setting up a shell script with menues and sub menues, options, etc. But on each menu/submenu/etc, i need a "Go back to main menu" choice. I've already got the menu set up and it works fine, but i ...
6
votes
3answers
831 views

directory name with space and bash

I'd like to exclude the directories "temp" and "Ubuntu One/" from backup. What is the correct escaping of the space???? RSYNCCONF="--delete --exclude=.* --exclude=temp/" Thanks in advance! Chris ...
6
votes
1answer
6k views

How to create Excel xlsx files from a script?

I'm looking for packages available in Ubuntu main/universe repositories able to create Excel 2007+ xlsx files from a script (python or perl) My requirements: 100% compatible Excel XLSX files. Solid ...
6
votes
2answers
1k views

Enabling unattended-upgrades from a shell script

I have a shell script to automatically configure new Ubuntu virtual machines for my purposes. I would like this script to install and enable unattended-upgrades, but I cannot figure out how to do so ...
6
votes
3answers
3k views

Command to activate (either run or bring to front if already running) a program

I want to be able to have a keyboard short-cut to either start or bring to the front a program. (sqldeveloper if it matters) I know how to run it, that leaves: 1) how do I find out if a program is ...
6
votes
2answers
5k views

What is the default character encoding?

I don't myself know how deep this question actually goes (for example, for all I know there could be several, depending on my task). Particularly, I am interested in what kinds of strings are used to ...
6
votes
1answer
159 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 "." ] ...
6
votes
1answer
5k views

bash script source: No such file or directory

I have a script that begin like this #!/bin/bash VALKYRIE=~/myProjects/valkyrie source $VALKYRIE/cluster.conf but when I run it it returns line 2: ~/myProjects/valkyrie/cluster.conf: No such file ...
6
votes
1answer
4k views

How to automatically install entire Google Web Fonts collection?

I'm basically looking for an unattended way to deploy/install the Google Web Fonts collection into several Ubuntu boxes. I've searched for PPAs, packages or user scripts but without much luck. Any ...
6
votes
1answer
4k views

Bypass “Do you want to…” dialog after clicking script

After I create a bash script and double click it in Nautilus I am prompted with this - Do you want to run "sleepytime", or display its contents? With Run in terminal, Dislpay, Cancel and Run as ...
6
votes
1answer
989 views

How to make gnome always run a script, not ask if it should be displayed?

I have written a script: for FILE in *.svg do inkscape --file=$FILE --export-area-page --without-gui --export-pdf=${FILE%.*}.pdf done which converts all SVG files in a directory to PDF. ...
6
votes
1answer
456 views

Create a script to open firefox with some google search term from terminal

Is there any way to create a script or a program that will open firefox, go onto google and search for the arguments passed to it ? So something like google How do I shoot web should open Firefox ...
6
votes
1answer
718 views

Can you help me write a script to set a new default brightness for the screen/keyboard after login?

On my Macbook Pro Ubuntu alsways boots with... keyboard brightness at maximum illumination screen brightness at maximum illumination ...both which I need almost never during normal usage. ...
6
votes
2answers
978 views

How can I create automated keyboard scripts?

Is it possible to do the following in Ubuntu? If so can someone point me in the right direction. Say you want to set a keyboard shortcut to do the following: For examples sake, set Alt+F to open ...
6
votes
8answers
3k views

Which download manager is capable of 'throttle' and 'pause & resume' a running instance of download from a script

When downloading big files it necessary to pause the download many times. A big file can be downloaded by using wget. First start download, then kill wget, then resume download by wget -c. I want to ...
6
votes
1answer
826 views

How can I make a script to place files older than each day before into their own folder?

I'm running an unnecessarily complex script which looks similar to this command: find /home/user/videos/*.avi -mtime +0 -exec mv -f {} "/home/nb/videos/1 day old" \; And then I run the same ...
6
votes
3answers
6k views

Run script as root at login (no sudoer user, shell session)

Much like /etc/profile and ~/.profile but ran by root instead of the user is doing login. /etc/rc.local runs after boot but I need running the script before login. The user is not a sudoer one. ...
6
votes
1answer
387 views

How to run a script when password is entered at the lock screen?

To toggle the enabling/disabling of my notebook's touchpad according to connected USB mouse, I used touchpad-indicator, which runs a daemon to monitor connected devices and take appropriate action. ...
5
votes
3answers
877 views

Why is this bypassing the SUDO password?

I have a bash script I am using to automate a SVN checkout. The contents of the file were: #!/bin/bash cd /var/www-cake sudo svn checkout file:///usr/local/svn/bash_repo/repo/ Then when I double ...
5
votes
5answers
433 views

Needed simple script/loop/command for input command, execute and output within textfiles

Suppose I have list of commands in text file as below (cat cmdlist.txt):- cut lshw top awk sensors Now I want to get simple information on that command by whatis cut, whatis lshw etc. respectively ...
5
votes
4answers
8k views

Is there a standard place for placing custom Linux scripts?

I am developing a set of scripts, which I want to be present for all users, when I set up a server. But I don't want them in the standard locations like /usr[/local]/[bin],[sbin] etc. Is there some ...
5
votes
3answers
4k views

How can I make a script run automatically after gdm login and logout?

I have a setup where my users log on using ldap and it works just fine. I want to run a script after my users login (its a script that will detect which groups they are in and map network shares ...
5
votes
5answers
3k views

Which torrent client has command line arguments to start/stop downloads?

first of all, I want to create shell script to start/stop downloads in torrent client. I don't need CLI but if you know how I can do that with CLI using shell script then it is okay. I use ...
5
votes
1answer
6k views

How to loop through arguments in Bash ($1 $2 $3 and so forth)?

I have the following code snippet for num do echo $num done But I don't understand why it works! How come does Bash know to loop through my params $1, $2, $3, $... using my personal taste of ...
5
votes
1answer
938 views

How to send keystrokes to Chrome in Ubuntu?

I would like my computer to press the Esc key every 2 minutes. How can I do this? With and app or shell script or otherwise?
5
votes
2answers
478 views

Move multiple files to a dir if their names contain the same string present in dir name

I have multiple files in one folder: ABA.xy BEB.xy ACA.xy The same files with different extension in another folder ABA.rr BEB.rr ACA.rr Then I have single folder for each file name ABA BEB ACA ...
5
votes
4answers
1k views

How do I make an entire directory executable?

I have an entire folder dedicated to python scripts. I'm tired of doing chmod on every new python script that I write. Is there a way to make every file inside my folder executable if it is a python ...
5
votes
2answers
319 views

How can I delete numbered files in a given range?

I have folderA that has some files with a number sequence starting with a_000000. What I want to do is to delete files starting from a specific number: let's say a_000750 till the end of files in this ...
5
votes
2answers
206 views

Why are my bash script's arguments causing an error?

In order to make uploading the code to github easily, I created a sh script #commit.sh git add . git commit -m $1 git push origin master But when I run it by saying ./commit.sh "comment1 comment2 ...
5
votes
1answer
2k views

How to execute a script as super user first checking the user and getting pass from askpass if not super user

thers a similar question out there How can I determine whether a shell-script runs as root or not? I have the same doubt with different result Is it possible to, within the BASH script prior to ...
5
votes
5answers
2k views

How to collect all the “txt” and “log” files using find?

I currently have this script: find . -iname '*.log' -print0 | xargs -0 tar zcf $file To collect all the "*.log" files from a given directory. I would like to modify it to include also all the ...
5
votes
3answers
283 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 ...
5
votes
3answers
2k views

How to get longest line from a file?

I'm interested to find out the line number of the longest line from a file. For example, if I have a file with the following content: lalala tatatata abracadabra mu mu mu how can I write a bash ...
5
votes
2answers
173 views

How do I get a list of non-LTS packages installed efficiently?

I'd like to see to what extent my system is LTS-supported by means of what packages are supported for 5 years and which are not. I could disregard some non-5yr-supported packages, as some are rarely ...
5
votes
3answers
27k views

Run a script on login using ~/.bash_login

I need to run a script when I login and logout in my Ubuntu. I tried to put the script in my ~/.bash_login but it didn't work. Is there a better location where I can run my script? My script is ...
5
votes
2answers
8k views

How to write Bash script What is the command to open a terminal with two different tabed terminals and execute some commands separately tabs?

How to write Bash script to open a terminal with two tabs, and execute commands in both tabs? for instance: tab 1 opens skype tab 2 opens chromium-browser In the end, I want one more thing: write a ...
5
votes
2answers
8k views

Writing scripts with arguments?

I want to write shell script that takes an argument, and then applies it to files. Specifically, I want to give a term, and then have it compile term.as with mxmlc ("mxmlc term.as"), then run ...
5
votes
2answers
5k views

How can I run an application in gnome-terminal automatically when booting?

I need to run an application automatically when Ubuntu starts. I've got this app running without opening the terminal. However, this application displays some information in a terminal window and, ...
5
votes
3answers
147 views

To which directory should I install a program from a bash script?

I want to install Netbeans 7.0.1 with a bash script from the Netbeans website. The default directory chosen by the installer is /home/geoffrey/netbeans-7.0.1. But I do not think it belongs there.
5
votes
4answers
17k views

Finding CPU usage from top command

I'm currently using top -b -d 1 > file1.csv to append the entire output to a csv file. However, I'd like the Cpu(%us) field alone to be entered in file1. I've gotten as far as this: top -b -d ...
5
votes
1answer
49 views

Use the bang-commands (e.g. '!!') of bash in scripts and aliases?

Is it possible to use the so-called bang-commands (! + command/symbol, like e.g. !! or !$:p) in bash scripts and in bash aliases? I wanted to add the line alias getit='sudo apt-get install !!' to ...
5
votes
3answers
1k views

Evaluating a string in shell script

I am following this bash shell scripting guide: http://www.tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html In the section Numeric Comparisons, it cites an example: anny > num=`wc -l ...
5
votes
3answers
16k views

Proper way to add a user account via bash script

Here's the script code I'm using now: getent group $MYGROUP if [ $? -ne 0 ] ; then sudo su -c "groupadd $MYGROUP" fi sudo su -c "useradd mynewuser -p mypassword -m -g $PRIMARYGRP -G $MYGROUP" ...
5
votes
2answers
247 views

How do I script juju deployment?

I have been working on a few juju charms and am ready to start testing a deployment of our services. Is there a standard method for deploying an environment? For instance, do I have to manually ...
5
votes
1answer
942 views

How to make scripts run in Guake terminal instead of normal terminal?

I have installed Guake terminal and I find it amazing. I have many scripts added as .desktop files in launcher. Now I want these scripts to run in the Guake terminal instead of opening in the normal ...
5
votes
3answers
758 views

Pipable command to print in color?

I'm a bit new to bash scripting, and I'm wondering if there is a program or built-in command to pipe to that will print in a specified color? Or is there an echo argument to do so? Like I could do: ...
5
votes
2answers
783 views

How do the environments of a standard Terminal command-line and a bash script differ?

I know there is something different about the environment of the Terminal command-line and the environment in a bash script, but I don't know what that difference is... Here is the example which ...
5
votes
1answer
2k views

How to batch rename files (images) based on CSV file

What I have and want to achieve: There are thousands of images in one folder. I have a CSV file with following columns: A: original name B: renamed name A typical row looks like this: ...
5
votes
2answers
799 views

Recursively apply the msgfmt command to all .po files in directory with find -exec

I have the following directory structure: webiste/ locale/ en/ LC_MESSAGES/ translation.po de/ LC_MESSAGES/ ...