In shell scripting, a shell such as bash runs a file containing a list of commands (a script). The script is effectively a program and the shell is its interpreter.

learn more… | top users | synonyms

1
vote
1answer
27 views

Shell script to run VM [duplicate]

I use Virtualbox. Instead of clicking on the button of the name of the virtual machine to run it, I want a shell script that can run a Windows XP virtual machine hosted on Ubuntu machine. Can someone ...
1
vote
1answer
25 views

Write a Script to install an application under wine

I have a non-techy friend who's giving Ubuntu a shot and I'm basically undertaking the challenge of trying to make it as painless as possible. He would like to install iTunes on his machine but I'd ...
0
votes
1answer
14 views

How can i Download attachments from an email using Python?

My Current python script can download attachments from Gmail. But i want to Download Attachments from any other email services than Gmail. Ex: Other email services are ymail, hot mail, etc .. Is ...
0
votes
0answers
16 views

how to install ksymoops on Ubuntu 14.04

I want to analyze kernel crash(Oops) using ksymoops. I am trying to install ksymoops on Ubuntu 14.04(LTS) 64 bit using command sudo apt-get install ksymoops but unable to install. Below mentioned ...
0
votes
1answer
30 views

Unigine Heaven run directly from terminal?

I think a lot of you would have benchmarked your Linux system using Unigine Heaven Benchmark 4.0. I know to run the it you can simply go to the Unigine Heaven folder and run the shell script file ...
0
votes
2answers
52 views

How to learn shell programming in linux ? [duplicate]

I use ubuntu and have no idea about dos/powershell programming and I know only c language. please suggest a good book on shell programming , and also any advice regarding prerequisites for shell ...
0
votes
1answer
36 views

How to write shell script for creating zip ?

I need to write a shell script .sh file which is creating a zip file from /var/www as a sudo user. I have my Ubuntu server and my site hosted on it which means my source code is in /var/www ...
-1
votes
0answers
33 views

java install shell script

Hi i need to write shell script which first check java is installed if not download and install.This is my script.But my machine already installed java.Then it is downloading(apt-get install).So can ...
1
vote
0answers
33 views

How can I automatically reboot machine after usb pull off?

I have this situation - I've got a boot-able pen-drive with Ubuntu 12.04 for automated installation - when I plug the USB stick in installation begins from it. At the end of installation process I ...
1
vote
1answer
60 views

Run the script file after 5 or 10 min after restarting the system

I have created a ruby script file that checks the connection present or not. For example checking port 22 is opened or not. Firstly I tried with cron job as follows @reboot find ...
0
votes
1answer
37 views

Execute 'make' from another directory [closed]

Is it possible to execute make without going to the directory that contains the files? I mean, if my current directory is my home, and I have a directory named project that includes a makefile, how I ...
1
vote
1answer
43 views

bash : update apt-get only if apt cache is older than 10 minutes

I'm trying, with a script, to test if apt cache is older than 10 minutes old if [ "($(date +%s) - $(stat -c %Z /var/lib/apt/periodic/update-success-stamp)) -ge 600000" ]; then echo true fi But it ...
1
vote
1answer
26 views

how to test if the apt cache is up to date with bash

I'm searching a way to test in a bash script if a cache update is needed (to avoid unnecessary apt-get update when the apt-cache have been updated recently). can someone help me?
1
vote
1answer
28 views

Echo script arguments from function

I need to get script arguments within function with arguments. ./myscript 1 2 3 function_name () { if [ $1 == 3 ]; then # I need the $1 in the following echo to be the script argument, ...
0
votes
1answer
14 views

dconf change a string key

I'm trying to change a string based dconf key with a bash script, using the following command line: dconf write /org/gnome/nautilus/preferences/show-directory-item-counts 'never' But it return the ...
2
votes
3answers
79 views

Cleaning up yesterday's files via script

I would like to run a cronjob that ran every morning to move the files that were created on the previous day in a specific directory to be moved to a folder that has been created with the previous ...
0
votes
1answer
28 views

Autocomplete filename in script

I have been searching for a solution to this problem for a while. I am trying to find a way to use autocomplete for more than just commands, eg: for files inside the current folder. One possible use ...
1
vote
2answers
59 views

How to use -exec option in find command

I wanna solve some problems in compiz with my brain and hands. By the way I entered following command to build compiz from source in Ubuntu 12.04 find /opt/compiz-built/share/gconf/schemas -exec ...
4
votes
1answer
333 views

How to make a file executable? [duplicate]

How can I make my file so that I can double click on it, and it runs. It is a .sh script, but I also have files that say: executable (application/x-executable) in the description of what they are. ...
1
vote
3answers
63 views

Print only the first match once

I have a code snippet that I am using to parse through a log file and print information I need. for i in $(cat ~/jlog/"$2"); do grep "$1" ~/jlog/"$2" | awk '/\([a-zA-Z0-9.]+/ {print ...
0
votes
3answers
45 views

shell scripting works with bash but not with sh

#!bin/bash NAME[0]="KANNA" echo "first name: ${NAME[0]}" .The above script is executed with bash filename but not with sh filename
0
votes
2answers
45 views

Regular expression

I have a code that is looking for a specific pattern in my log files. Usually it begins with Association ID = (This is what I am looking for in parenthesis). Now the code I have made so far is ...
3
votes
1answer
98 views

Is there a command that detects if the CD drawer is open or closed?

Is there a command that you can run in a shell script that would detect if the CD tray is open or closed, and return 1 or 0 depending on whether it was (or something easy to interpret)? Currently, I ...
1
vote
2answers
85 views

Run program as root without using sudo

Can someone help me to run a ".run" on Ubuntu 12.04 LTS. My problem is I want to execute this program as super-user, but I don't want to use sudo to run it. I just want to run with ...
0
votes
1answer
39 views

Good shell script to move a file to another location?

I'm trying to write a shell scrip to move a file to a a different location when it's found. And when it's not found to move a file from that different location to its location. This is basically my ...
-2
votes
1answer
39 views

edit file in shell script

I'm new to Linux. I'm running a simulation package on Linux. For each iteration, a file as below will be generated. I need to do some modification and then use the modified file as an input for the ...
17
votes
2answers
577 views

Know whether the shell script contains syntax error without running the script

I have a long shell script containing a lot of conditions and I want to know whether there is any syntax error in the script without running it. Since shell script is interpreted I think it is not ...
2
votes
1answer
47 views

how to list all directories and a specific line inside a file in that directory

My server has hosted many websites for testing/dev purposes. My problem is that my mysql server has around 95% load. So, I want to list all the directories and the db lines from config.php. Things ...
1
vote
1answer
66 views

“dirname: invalid option — '/' ” Error when I try to run a .sh file?

I'm trying to run a file in Linux(Ubuntu 14.04), but I get this error: dirname: invalid option -- '/' Try 'dirname --help' for more information. The command I am using to run the .sh file ...
0
votes
2answers
46 views

Shell script read problem [closed]

I'm trying to create a shell script with a read command, so that when I run the script, it will ask the user a yes- or no-question. If the user types yes, the script continues, and if she writes no it ...
1
vote
3answers
52 views

Help creating a messagebox notification with yes/no options before an application runs

I started using Ubuntu alongside Windows about 2 months ago. I've slowly been adding all of the programs that I use regularly to Ubuntu, so that I will eventually be able to do everything in Ubuntu ...
2
votes
1answer
49 views

error while running ruby application at system startup in ubuntu

I am on Ubuntu 12.04 machine. Have a script file which runs when entered manually in terminal gnome-terminal -e /home/precise/Desktop/cartodb/script.sh The content of script file is cd ...
5
votes
2answers
183 views

Hiding output of a command

I have a script where it checks whether a package is installed or not and whether the port 8080 is being used by a particular process or not. I am not experienced at all with bash, so I did something ...
1
vote
1answer
89 views

add-apt-repository and update and install package

I find add-apt-repository very userful and use it quite often. I was wondering why it doesn't provide an option to do the add + update + install package in one command. I was planning to make a script ...
13
votes
6answers
1k views

Renaming hundreds of files at once for proper sorting

I have a ton of files, all named stuff like 1.jpg, 2.jpg, 3.jpg, and so on up to 1439.jpg. However, I have a problem with one of my projects and alphabetizing. It will usually go in the order 1.jpg, ...
0
votes
0answers
46 views

c programming within shell scripting

The code is as follows: #!/bin/bash ./finger/fingerprint /dev/ttyUSB0 /status.txt /template.txt; wait clear fingerstatus=`cat /root/status.txt` if [ "$fingerstatus" = "AUTH" ] then echo ...
-1
votes
2answers
34 views

Enter before continue [closed]

I make some scripts to install programs automatic but is there a option to do the following. Press Enter to continue or any other key to skip and go to the next thing? For example, the script will ...
1
vote
1answer
189 views

Permission when running script in Vagrant using Vagrantfile

I have created a vagrant box for running rails applications and I have managed to create it manually. My next step was to create a shell script that I can include in the Vagrantfile so when creating ...
1
vote
2answers
58 views

Running a shell script automatically [duplicate]

Could any one please suggest me on which boot level or /etc/rc.x folder should I include my shell script so that it runs automatically immediately after login or just before the system prompts for ...
3
votes
2answers
78 views

Why “./” is used to run “.sh” scripts in Unix? [duplicate]

I am executing a .sh script today. It is executed with prefix "./.sh,I am a bit confuse because it is also executed without ./.but why this is required to use ./ Could you please explain me that why ...
1
vote
3answers
106 views

Extracting all PDF Links from Multiple Websites

Glutanimate posted a script that extracts all PDF links from a single page. Any idea on how to change this so the script can grab all the PDF links from a list of URLs ?
1
vote
1answer
46 views

I need to check for dpkg lock before installing apps in a script [duplicate]

I have a problem with a script I wrote to install a bunch of apps, basically as it loops through an array of app names to install it checks them by doing: dpkg -l | grep -q $i and based on the $? ...
1
vote
3answers
499 views

ubuntu 14.04 + gnome 3.10 + gnome-shell restart

Is there a way to ask gnome-shell to run a shell script every time it starts? (Like after a Alt+F2 then r, not on Login) NB: If you think it's about the start-up list, it's not : do a Alt+F2 then r ...
0
votes
3answers
118 views

How can I extract user data from a file with awk and create a new user based on it?

I need somebody who could help an exercise. I can only use shell scripting and awk to do it: You have a text file called users.txt with this info inside: users.txt: Peter:7777:/home/store ; ...
2
votes
1answer
131 views

How to pause with specific time between two command in script?

I want to do such as following: #!/bin/bash command1 pause 30 seconds command2 exit This is only example script with pause of 30 seconds between run of 2 command. How to do this?
0
votes
0answers
27 views

Tracking active time Gnome session [duplicate]

for my job I want to track the time I am actually working on my computer. Therefore, I am wondering how it is possible to track the time I am logged in in Gnome but not locked the screen. Does anyone ...
0
votes
1answer
84 views

How to make a shell file execute by double click

I have tried right clicking on the file selecting properties and then the permissions tab and setting it to execute. However, when I double click the file it opens in gedit. What do I do?
3
votes
2answers
25 views

How can I move the results of a Recoll query to a folder?

I'd like to know if it's possible to send matching files from Recoll (searches words or strings in the content of several files .pdf .doc, etc) into a folder. Thanks!
22
votes
3answers
1k views

Where should I put my script so that I can run it by a direct command?

Where can (should) I put my (bash) script so that it can be used (forever) by terminal or by a direct command: Alt+F2? I know there is /usr/bin and /sbin & /bindirectories but when should I use ...
0
votes
0answers
126 views

move files and auto rename if same name | bash script find all *.extension

Something like "--auto" in: http://doc.bazaar.canonical.com/beta/en/user-reference/mv-help.html It seems a bit complicated to --no-clobber (-n) and work on return codes if [ $? -eq 1 ];then ...