A shell script is a script written for the shell, or command line interpreter, of an operating system.

learn more… | top users | synonyms (1)

5
votes
2answers
143 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
4answers
8k views

Problem with Bash script: 'declare: not found'

I had a script which was running fine but when I ran it today, it says declare: not found. I am using bash shell and path at the starting of the script is correct. Two flagged lines in my script are ...
5
votes
3answers
1k 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
7k 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
4k 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
1answer
2k views

How to create Excel xlsx files from a script?

I'm looking for packages available in Ubuntu main/universe repositories (14.04) able to create Excel 2007+ xlsx files from a script (python3 or perl) My requirements: 100% compatible Excel XLSX ...
5
votes
3answers
619 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
1answer
788 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
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 ...
5
votes
1answer
1k 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
176 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
3answers
559 views

Where are logon and startup scripts for graphical settings located and how are they managed?

Where and how are the Ubuntu equivalent of your personal Windows configuration stored? Something akin to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run as well as the Start Up menu. ...
5
votes
2answers
868 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 ...
5
votes
1answer
305 views

My bash function runs only once per terminal opened

When I try to run my bash function, defined in .bashrc, for a second time in the same terminal, it doesn't work. The code is the following: function nos (){ local option while getopts cs ...
5
votes
2answers
11k views

bash: [: too many arguments?

I'm trying to create a directory and cd into it: In ~/.bashrc: function abc() { appname=$1 appdir="$HOME/code/$appname" if [ mkdir $appdir -a cd $appdir ]; then echo Success else ...
5
votes
2answers
690 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
1k views

Changing media key defaults in Gnome

Under XFCE, I had option to set my keyboard media keys to run particular programs or scripts. I understand the options to adjust the Keyboard Shortcuts under Gnome, but how do I change the default ...
5
votes
3answers
188 views

How to pass '*' wildcard to path parameter of find command via a variable in script?

I want to use find to find files in a set of folders restricted by wildcards, but where there are spaces in the path name. From the command line, this is easy. The following examples all work. find ...
5
votes
1answer
4k 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 ...
5
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 ...
5
votes
4answers
1k views

A script for moving files from subdirs to parent dir

I am looking for a script for moving files from subdirs to the parent directory My folder structure looks like this. Inside of a folder A I have a lot of folders named 1,2,3,4,5... All these ...
5
votes
1answer
2k views

How to set keyboard shortcuts from a script

I appear to be suffering from this bug that means my custom keyboard shortcuts are lost on reboot. I have 8 custom shortcuts, and re-setting all 8 via the GUI method for setting keyboard shortcuts is ...
5
votes
3answers
2k views

Removing numbers and hyphens from file names recursively

I am modifying a simple BASH script to remove numbers and hyphens from the start of my MP3 files. The aim is to rename files such as: 11 Song 1.mp3 1-1-Song 2.mp3 11-1 Song 3.mp3 to: Song 1.mp3 ...
5
votes
1answer
3k views

blackhole exploit kit - Linux Server Script

It has come to our attention when scanning some of our hosted server websites that they have been infected with Blackhole Exploit Kit (top dollar hacking program - ...
5
votes
1answer
833 views

Customize Gnome-Do's default action order

I'm using Gnome-Do with the "Files and Folders v2.5" plugin. I set it to read my .scripts folder, so that I might run my personal scripts from Gnome-Do. The only problem is that Gnome-Do's standard ...
5
votes
2answers
146 views

How to save images from web links given in .xls file

I have an xls file which has weblinks of product-images. The number is about 5000. Can you advise me how can I save these images on my computer. Given here below is a link just to narrate the example. ...
5
votes
2answers
4k views

Python script won't write data when ran from cron

When I run a python script in a terminal it runs as expected; downloads file and saves it in the desired spot. sudo python script.py I've added the python script to the root crontab, but then ...
5
votes
1answer
3k views

Start multiple apps running in shells split in one console

I need to start multiple apps running in shells and monitor their execution. Currently I have a main script that launches every apps in a new gnome-console but I would prefer to launch them all in the ...
5
votes
1answer
241 views

How to set my Bluetooth python script on higher priority than Ubuntu's request?

I have got a Bluetooth Python Server Script on Ubuntu to connect with an incoming request from a Smartphone device. However Ubuntu's Bluetooth is getting the request before my script can react on it. ...
5
votes
3answers
410 views

Convey some message to all users

Is it possible to write a shell script that enables any user (may not be root) to set a message(e.g. "Download on progress do not turn off" etc.) which will be conveyed like pop-up message (zenity or ...
5
votes
1answer
5k views

Script at /etc/init.d does not run at start-up

I wanted to run my Dropbox daemon automatically at start-up. I did it via terminal, that is, I (1) moved it to /etc/init.d, (2) made it executable, and (3) ran sudo update-rc.d dropbox.sh defaults. So ...
5
votes
1answer
299 views

NetworkManager run script before connection based on SSID

Is it possible to have NetworkManager run a script before it connects to a wifi network and pass the SSID of the network to the script (or just execute a script based on SSID)? I'm switching back from ...
5
votes
2answers
2k views

How to diff two folders to multiple patch files

I'm not much of a unix guy so I'll just go ahead and ask: I have a following problem - two folders with plenty of subfolders. I need to diff them. I tried this: diff -drupN vanila_kernel_3.0.8 ...
5
votes
1answer
9k views

rc.local is not always executed upon boot

Hey, I have some weird problem with the rc.local file which is located in /etc/rc.local the thing is that it is not always running when I boot up the laptop. Maybe every second time, I haven't ...
5
votes
1answer
606 views

Can I set up two key-bindings to launch the Main Menu? … specifically: Alt+F1 and Super

I've set up the Super key to open the main menu. It works. gconftool-2 --set /apps/metacity/global_keybindings/panel_main_menu --type string "Super_L" , I have a shell script super.sh which ...
4
votes
3answers
5k 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 ...
4
votes
2answers
2k views

How to shutdown Ubuntu after (2 hours) of idle?

Running: Xubuntu 14.04 32bit. I have read several outdated, not working, working different that I want answers here and elsewhere. I had a script that resulted in shutting my Laptop down at boot time ...
4
votes
4answers
312 views

How do I extract the version number portion from the version string?

How do I extract the version number from string=customer-asset-tag-1.0.2.9? Desired result: Component= customer-asset-tag version number=1.0.2.9
4
votes
4answers
377 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 ...
4
votes
2answers
4k views

How to pass results of bc to a variable

I'm writing a script and I would like to pass the results from bc into a variable. I've declared 2 variables (var1 and var2) and have given them values. In my script I want to pass the results from ...
4
votes
1answer
4k views

Startup script for a specific user on Ubuntu Server

Here is the command I want to be run at startup: VBoxHeadless -s "pfsense" as user "enedene". Could someone give me step by step instructions?
4
votes
1answer
1k views

Bash script: How to execute commands consecutively without waiting for the previous one?

In a bash script that execute 2 commands like this #!/bin/bash gedit nautilus Nautilus starts not before gedit is closed? How can i avoid this?
4
votes
2answers
1k views

Can I run command-line commands within a python script?

Sorry I'm kind of a noob at this: Basically I've downloaded this package that deals with text files that is run from the terminal, but the command I need takes in two arguments. I also need to do ...
4
votes
2answers
2k views

How to check how long a video (mp4) is using the shell?

I need to ftp upload all the mp4 files in a directory with length > 4 minutes using the shell. I can't find any script to check how long a video is. Does anybody have any idea how to do that? Thank ...
4
votes
2answers
9k views

bash script to login to webpage

I am trying to login into this page but I cannot for the life of me get it to work. I have to login to this site when i connect to my school's wifi in order to start a session. So far ive tried to ...
4
votes
3answers
21k 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 ...
4
votes
2answers
876 views

regex search works with `grep -E` but not with bash script?

I use the same regex with grep and it gives me a match but when doing it in a bash script, it return no match. Test String(part of the file testregex.txt): <a ...
4
votes
2answers
268 views

How do I iterate the arguments in a bash script?

Is there any method to iterate the passed arguments in a bash script? This answer from my question shows me how to use each argument, but I want to iterate them because the number of arguments is ...
4
votes
1answer
163 views

Help Debugging Backup Script

Every 3 hours the script will run and backup a folder "SOURCE" and it will save it along with the other backups of the current day in the folder "month-day-year" e.g. "03-24-13". When a new day comes, ...
4
votes
2answers
536 views

What's the difference between root account and simulated roots?

So if I disable my root account with sudo passwd -dl root I still have access to sudo {su,bash} or sudo -{s,i} conceptually how are the elavated rights different from the root account? I know the ...