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 (4)

4
votes
3answers
4k views

Cannot use “./” to execute a shell script

Maybe someone here would be able to help me out. Have installed Ubuntu 12.04 LTS (kubuntu) on two machines. The .bashrc and .bash_profile files are identical as the file structures on each machine is ...
5
votes
1answer
3k 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 ...
2
votes
1answer
361 views

How to run a one-line bash command with a keyboard shortcut?

I just made a custom keyboard shortcut, which is to execute the following command : if [[ `banshee --query-current-state | grep playing` ]]; then banshee --pause; else banshee --play; fi While this ...
5
votes
1answer
17k views

Add environment variable to .bashrc through script

I need to add the following lines to the end of .bashrc file in Ubuntu. How can I add these lines automatically using a script. If I run the script, then it automatically inserts the lines at the end ...
2
votes
1answer
519 views

Custom status Byobu

#! /bin/sh echo "$(byobu ls|grep attached)"|sed 's/\([a-zA-Z0-9][a-zA-Z0-9]*\).*/\1/' this is my script in ~/.byobu/bin/ refresh time is 1 second. This shows the session name as the custom ...
3
votes
1answer
459 views

Need to write a script that will jailkit a user and give them access to a particular website directory

I have a ubuntu 12.04 app server hosting a few websites. We need to give access to the developer to only be able upload files to one of the websites. I have installed Jailkit but can't seem to find ...
1
vote
1answer
509 views

Bash Script Progress

I am forming a new question based on an earlier one I posted here in regards to a BASH Script I am writing. This is only one function of the script but I started here because I figured I would have ...
3
votes
1answer
5k views

how can i write a shell script that will run at startup and introduce a delay in the start of an application

I have an application installed for my samsung NP-RV509 installed that makes the fn keys work properly.. I figured it out that it is the reason behind almost 30sec xtra booting time... so i was ...
6
votes
2answers
11k 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 ...
10
votes
3answers
2k 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 ...
1
vote
3answers
558 views

Script to un-hide files with specific extention in folders reccursively

I have this folder that contains many folders, each containing many files with the name structure .XYZ.zip. I'd like to rename them (using bash) to XYZ.zip (i.e. un-hide them). I've seen a question ...
3
votes
3answers
5k views

Transmission shutdown script for multiple torrents?

I have written a shutdown script for transmission. Transmission calls the script after a torrent download finishes. The script runs perfectly on my machine (Ubuntu 11.04 & 12.04). #!/bin/bash ...
2
votes
2answers
322 views

How to be warned if RAID 1 fails on Ubuntu 10.04

Good day, I have set up an ubuntu 10.04 LTS server with RAID 1. How can I can ensure that I am warned when the raid array fails. Is there a script to run that can check this and generate an email if ...
0
votes
1answer
254 views

xdotool mousemove blank screen script question [duplicate]

I have infamous screen going black after 10 minutes or so despite trying several solutions to avoid it in Ubuntu 12.04 So i decided for the last solution which is emulating mouse move every 9 ...
7
votes
3answers
5k 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 ...
2
votes
1answer
97 views

Allow any user to use shutdown with my own shell

First of all sorry if my english is not excelent but it isnt my native language. I have a project where I'm building my own shell (named MYSHELL). One of the tasks is to create my own built-in ...
0
votes
2answers
2k views

How to Create Deb Files [duplicate]

Possible Duplicate: Simplest Debian Packaging Guide? I have a group of BASH scripts, XML files, etc. The scripts require that some programs already be installed. How do I create a *.deb on ...
3
votes
3answers
639 views

need a different backup solution

I just built a new media/backup server using Ubuntu 12.04 64bit. I installed a hard drive to be used only for music, pictures, and videos and formatted it fat32 so my 1 and only Windows PC could map ...
2
votes
2answers
1k views

bash script ask for root password

I want have a script that I can give to friends which will add repositories and download files, install them without having to use command as they are not command line savey and have no desire to ...
2
votes
2answers
21k views

How to start Teamviewer or any program before login [duplicate]

Teamviewer is a remote desktop application, it doesn't have to be this one, I'd be interested to know the following for any remote desktop application like VNC or RDP. I added a "Startup script" to ...
1
vote
2answers
6k views

Parsing a HTML page with Bash

I'm trying to write a Bash script that will extract informations from a HTML page (using wget). I know my informations will be between <h*> tags, but is there a nice way to get those ? To be ...
0
votes
2answers
105 views

Logging every time a command is run

I want to log every time I run a certain type of command in the terminal. For example, every time I run: sudo apt-get install [something] I want to add [something] to a log file in my home ...
20
votes
4answers
19k 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 ...
2
votes
1answer
105 views

Program/Wrapper (how do you call it) to automate a certain script

In this question a script is provided, that minimizes all the other windows except the active one. But the thing is, to trigger this script a (shortcut) key-combination has to be pressed. I would ...
1
vote
1answer
1k views

How do I delay Upstart's net-device-up signal until a condition is met?

I need to wait for a specific condition to be met a network interface is considered "up". Upstart is sending its net-device-up signal before this condition is met, which cases the scripts that depend ...
2
votes
2answers
1k views

How can I create a startup script that starts various Rails-required programs?

When I start my Ubuntu 12.04 vmware VM, I open up terminal and run the following commands. sudo /etc/init.d/postgresql start sudo /etc/init.d/apache2 start cd sites/name_of_rails_app bundle exec ...
1
vote
1answer
631 views

Script to recursively grep data from certain files in the directory

I am making a simple shell script which will minimize the time I spend in searching all directories under a parent directory and grep some things inside some files. Here's my script. #!/bin/sh ...
1
vote
3answers
2k views

How to run Shell script from HTML?

I'm somewhat new to Ubuntu Linux. I need to run the shell script from a html code. As I read somewhere like using Apache2 to generate a html and somehow I've succeeded to run a sh file from html, ...
6
votes
1answer
431 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 ...
4
votes
1answer
959 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 ...
0
votes
2answers
127 views

How to make this “svngrep” alias work on “.bash_aliases”?

I added to following line to the "~/.bash_aliases" file: alias svngrep='grep -R $1 ./* --exclude-dir ".svn"' but it's not working. It outputs (in my translation to English): svngrep test grep: ...
0
votes
1answer
61 views

What does ENDOFMENU do? [closed]

I have been given an example program, I am wondering what exactly the <<ENDOFMENU and ENDOFMENU does, won't it work the same if you leave it out and just use the while loop? #!/bin/sh echo ...
2
votes
3answers
996 views

Need Help in Creating Diskspace Script

I need help in creating a script that will run once a day in afternoon and collect the information of each partition(Disk Space , Total and Used) and send it to my email. Please help im very very ...
1
vote
1answer
3k views

How to run a bash script in terminal but hide the terminal on startup?

I have a backup script on start up with cuttlefish. I set it on "Run in terminal" but I want to hide the terminal on start up. I also have the terminal in the start up applications. How do I hide the ...
5
votes
2answers
3k 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 ...
1
vote
4answers
2k views

How do I get this script to run periodically via cron?

I made a script that sends my local sensors temperature to a server in the internet and then I can see a graph of it. Everything works fine when I execute it manully. I have the latest ubuntu version. ...
0
votes
1answer
2k views

Start command doesn't return for upstart script in Ubuntu?

I have written an upstart script called 'ts.conf' for a daemon and put it in /etc/init. When I try to start it with start ts I expect a confirmation message and I also expect to get the prompt ...
5
votes
4answers
687 views

Pulling multiple alternatives from a variable in a case condition

I'd like to use variable as condition in case statement. Something similar to: #!/bin/sh ALLOWED_SERVICES=tomcat6|james; case $1 in $ALLOWED_SERVICES ) service $1 restart ;; * ) ...
1
vote
1answer
758 views

How to fetch a image from online(http) and make it as a wallpaper using Ubuntu terminal

I need to change the background of my desktop in Ubuntu 12. 04 with a command in terminal, in order to make a script with bash. Does anyone know how to do it? but i want the image from internet... i ...
4
votes
1answer
416 views

Why Byobu custom status notification code fail to show in color?

The code below runs well in Bash and shows text with proper green background color but when I add it to the ~/.byobu/bin/ folder it shows the escape characters instead. Something like ...
3
votes
1answer
2k views

How to start a never ending script at startup

I'm trying to automatically run a never ending script (so it doesn't return 0 on exit) at startup on my headless ubuntu 12.04 server with no GUI. I have tried @reboot nohup /home/luke/netup.sh & ...
22
votes
2answers
60k views

How Do I fetch only the numbers in grep?

I have file like this : other lines . . . blah blah blah (:34) I wish to find the occurrence of numbers in the above file. I came up with : grep [0-9] filename But that is printing the ...
5
votes
2answers
19k 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 ...
0
votes
1answer
113 views

How to script a reinstall (apt repo's and installed packages)

I need to wipe my hard drive and reinstall Ubuntu. /home is on a separate partition, so I can back that up to a backup drive, then copy it back to the wiped drive, install ubuntu, and point it at the ...
3
votes
3answers
661 views

How to verify if a repository is already added

I have two repository that I want my script to verify if they are on the system. How can I verify by command line if a repository is already added to the system and, if not, add them?
2
votes
2answers
1k views

Bash: command not found

I have a script that needs to know the processor architecture. I'm doing this way: if [["$(uname -m)" = "x86_64"]]; then wget ...
14
votes
2answers
8k views

Is there a difference between “.” and “source” in bash, after all?

I was looking for the difference between the "." and "source" builtin commands and a few sources (e.g., in this discussion, and the bash manpage) suggest that these are just the same. However, ...
2
votes
1answer
5k views

Script to establish SSH tunnel and then run another program that uses the tunnel

I am running a GUI app (Gnucash) that connects to a remote Postgres database via a secure shell session. I can use the SSH -L command to tunnel a local port and then separately run Gnucash and this ...
1
vote
1answer
222 views

Run script after switching user account “to the same account”

In Ubuntu, when I click on Switch User Account... and then choose the same account to log in (for example if my name is John Smith, I click on switch user account and then log into the John Smith ...
0
votes
1answer
391 views

How can I change a folder's icon by using a script?

I have in my Profile folder "Home" some specials folders as "Wallpapers", "TXT", etc. and I use, for those personalized icons. The problem is that, any time I reinstall Ubuntu, I have to assign again ...