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
639 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
3k 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
1answer
963 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
4answers
807 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
3k 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
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
2k 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
792 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
5k views

Execute a script upon logout/reboot/shutdown in Ubuntu

I'd like to run a .sh file using bash on logout and shutdown of Ubuntu. I have searched up and down the web and have found only fixes for KDE and GNOME. The script is simple, I just need to know if I ...
5
votes
2answers
130 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
2k 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
163 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
329 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
4k 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
2answers
1k 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
590 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
3k 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
4answers
257 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
2answers
1k 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
3answers
18k 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
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
592 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
234 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
2answers
2k 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
2answers
493 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 ...
4
votes
2answers
6k 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 ...
4
votes
2answers
7k 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
2answers
791 views

Shell Script to Toggle Between Two Commands

I need help creating a shell script to toggle between two commands. When it is run command1 is executed then if it is run again it executes command2 and so on...
4
votes
2answers
160 views

How to organize a block of text in 8-character lines?

I'm toying around with binary code and ciphers and I've a chunk of text which I would like to reorganise in 8-character lines (those familiar with the topic will understand why). See: ...
4
votes
7answers
6k views

Filenames with spaces breaking for loop, find command

I have a script which searches all files in multiple subfolders and archives to tar. My script is for FILE in `find . -type f -name '*.*'` do if [[ ! -f archive.tar ]]; then tar -cpf ...
4
votes
2answers
373 views

Help organizing music

I have an Ubuntu server installation set up as a media server with Subsonic in a medium sized office environment. I allow uploads from all employees to the media folder on the server. As you can ...
4
votes
2answers
145 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 ...
4
votes
1answer
124 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 ...
4
votes
1answer
786 views

How can I set xdotool and gedit to open a document and save it twice?

I need assistance in creating a script that does the following: Open Gedit Open a document with Gedit Save the document twice Close Gedit I was wondering how can I make it happen with Gedit and ...
4
votes
1answer
3k views

Ubuntu 12.04 doesn't seem to execute my .profile file

(I'm kinna n00bish) 1: I had ubuntu 11.10 installed, then upgraded to 12.04. 2: I had a script in my .profile file to turn off my laptop's touchpad (it worked, and was executed on login) 3: Now it ...
4
votes
2answers
2k views

How to open several Terminal Tabs in different folders (working directories)?

I want one script to open several Tabs in different folders. While searching I found this entry, but an exchange like seen below did open a Terminal with three tabs in my home folder. The error ...
4
votes
2answers
352 views

Combine Two Commands In a Script

I want to put two commands together I need the script to login: ssh root@192.168.0.188 Then I need to the script to run (while logged in to root@192.168.0.188 via ssh ): find ...
4
votes
3answers
97 views

How to check the number of fields given to the `read` command?

I have a quick question relating to $# in the shell scripts. So, I can use $# at the command line to check the number of a shell script arguments given by the user. Example: # ./shellScript varONE ...
4
votes
1answer
608 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: ...
4
votes
1answer
580 views

how to resolve all symlinks in a directory?

I'm trying to make a debian package from upstream source code which is not mine. The configure script provided by author makes a lot of symlinks in source directory. They're symlinks to all headers in ...
4
votes
1answer
228 views

How to stop SSH filesystem from discarding root permissions after every command?

i have a small bash script that mounts my sshfs... problem is it ask for the server/host password for every mount... i have four mounts and i have to enter it every time for 4 times and its ...
4
votes
2answers
598 views

Where does wallch save the list of pictures and folders it takes pictures from?

I want to write a bash script which can remove the current wallpaper from the wallch playlist. By playlist, I speak of that list in wallch to which you can add pictures and folders, telling wallch ...
4
votes
3answers
12k 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 ...
4
votes
1answer
1k views

Starting a service from /etc/event.d works, but not from /etc/init

I'm trying to launch an upstart service on Ubuntu 8.04 from /etc/init/, but I always get start: Unknown job: job. When I try to launch this script from /etc/event.d/ it works fine. Why would this be ...
4
votes
1answer
2k views

Saving subtitles found by the VLC extension “Subtitle Finder”?

I found a VLC script called 'Subtitle finder' (here) that downloads and displays video subtitles 'on-the-fly': they are downloaded and displayed during playback, and it works great, but does not saves ...
4
votes
1answer
479 views

Custom command to open VLC with some options

I am trying to create a script to run vlc to play (or queue if a playlist is already present) some videos. so far in my ~/bin/ folder I have created a file ``myvlc'' with the following command: ...
4
votes
2answers
2k views

Problems creating a desktop entry for a shell script

I did the following procedures to create a application launcher but it doesn't work. create shell script named shell.sh with the following content: java -jar foo.jar Added execution permission: ...