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

0
votes
1answer
31 views

Open screen and run some projects and applications

I am a python web developer, I need to run my local 3-4 django projects in screen sessions and need to launch some of my applications like skype, chrome, eclipse and a text file daily status.txt. Is ...
1
vote
1answer
24 views

Providing input for while loop

while getopts "f:t:d:g:o:p:b:q:r:" opt; do case "$opt" in (f)fan=${OPTARG} (t).. esac done shift $(( OPTIND - 1 )); How to provide input? Can anyone plz tell me how to provide input for the ...
-1
votes
1answer
233 views

How To Run A Shell Script Again And Again Having X Interval Of Time In Root? [duplicate]

I have a shell script in my Ubuntu Server 14.04 LTS at ./ShellScript.sh. I setup /etc/rc.local to run the shell script after boot but before login using below code. To run run it boot write this ...
2
votes
2answers
89 views

.sh file on Startup Applications isn't executed

This is a followup to a question about dialog boxes. I want to show a dialog box both at the start of a session, and after n minutes of inactivity. I have decided to use zenity and xautolock. I have ...
1
vote
2answers
40 views

Do higher level scripting languages use shell scripts to work?

I'm just learning about bash and when I saw that bash uses 'echo' I tried to search for the relationship between PHP and bash and it seems like people are building programs were bash script and PHP ...
2
votes
1answer
50 views

script in bash not understood using terminal in Ubuntu 12.04 [closed]

Can anyone tells me what does this script means found in a .sh file:: [ ! -n "$T_R" ] && echo "Message Appear" && exit 1;
0
votes
0answers
22 views

how to detect the encoding of a file? [duplicate]

I have subtitles files, .srt i want a quick way to detect their encoding so i can tell devede what is their encoding so it can burn them correctly it would be nice to have a recursive script that ...
0
votes
2answers
40 views

Why doesn't this second nohup command run?

Everything runs except the last line: #!/bin/bash xinput set-prop 11 "Device Accel Profile" -1 xinput set-prop 11 "Device Accel Velocity Scaling" 1 xinput set-prop 11 "Device Accel Constant ...
1
vote
1answer
24 views

Why am I not getting the result of the addition?

I have written the following script file from my book. a=2 b=3 c=$[a+b] echo 'The result is:' $c After executing this program, instead of getting 5, I am getting output as: The result is: $[a+b] ...
0
votes
2answers
55 views

How do I get my shell script to automatically accept prompts?

I made a simple shell script (that I run as root) to download essential apps that I might need whenever I reinstall ubuntu: It looks like this: apt-get install docky && apt-get install geany ...
0
votes
1answer
15 views

How to take/release control of output?

I have two parallel processes running shell script, each will print to stdout from time to time using echo. But sometimes the output may mixed up. Is there a way to take exclusive use of stdout, then ...
0
votes
1answer
72 views

What causes “bash: /bin: Is a directory” every time a terminal is opened? [closed]

This is initial screen I am getting on Ubuntu 12.04, when I open a terminal (Ctrl+Alt+T): That is, the text on the terminal is: bash: /bin: Is a directory chase@chase-desktop:~$ gedit ~/.bashrc ...
2
votes
0answers
37 views

How can I run a simple rsync shell script at boot with root? [duplicate]

I have a shell script that contains a single rsync command to rsync two local directories. I want the script to run at startup/during boot and I can't seem to find the solution for this problem. ...
3
votes
2answers
264 views

Why I obtain this error when I try to perform this simple bash script?

I am following this tutorial to correctly execute Aptana Studio on my Ubuntu 14.04: Command menu in aptana studio 3 is not working in ubuntu 14.04 So I have installed the Oracle JRE and finnally I ...
0
votes
0answers
189 views

unable to run script using “startup applications” option in ubuntu 14.04

I am trying to run following script to run my rails application on startup but unable to execute. run_my_app.sh #!/bin/bash cd /home/<user>/<my_rails_app> && rails server ...
0
votes
1answer
48 views

how to bold the characters using echo

required output of echo in bold letters while using echo command I want the content to be bold and it should have same bold view while appending echo output to the file echo "hi">test.txt i want hi ...
0
votes
2answers
37 views

creating a command to load a shell script from command line

Right now when I want to run a specific program, I perform the following task: cd ~/Downloads ~/Downloads$ cd RubyMine-6.3.3 ~/Downloads/RubyMine-6.3.3$ cd bin ./rubymine.sh Instead of doing all ...
1
vote
1answer
33 views

Concatenate of Hostname in script is not working

I have to concatenate the Hostname in a file name and ssh it to a machine what i have currently is scp ../output/OutputFile50.txt sarah:~/client/output/OutputFile50${HOSTNAME}.txt it is working ...
0
votes
1answer
63 views

Shell script exits without evaluating if condition

I have the following commands in my shell script #This line basically builds a source library $BUILD_CMD $CONFIGFILES/$1.prj $BUILDFILESPATH if [ $? -eq 0 ];then echo "Build success\n" #do ...
7
votes
3answers
819 views

Error message 'source: not found' when running a script

I am creating a little automated setup script that will modify /etc/profile and $HOME/.profile if some paths are not exported. Then, I'd like to reload these automatically. I have read that source ...
1
vote
2answers
78 views

Automating rsync commands

I currently have too many rsync commands that I run on a day to day basis. Could someone be kind enough to let me know how I can automate these commands? I am new to Linux so a little bit of ...
0
votes
1answer
38 views

Ubuntu send alert mail if CPU usage continusly heigher than a certain amount

I need a way to send alert email if the CPU usage is higher than 80% for more than 5 minute. Installing new software on the server not allowed for me. Is there any way to handle it through a shell ...
0
votes
1answer
62 views

return value from awk

This is mybashfile.sh file . . . awk -f myawkfile.awk mytracefile.tr . . . Now I want to return one parameter from myawkfile.awk to the current mybashfile.sh. Is there any way to return a value ...
28
votes
3answers
1k views

Should I save my scripts with the .sh extension?

I have some functional scripts and I want to copy to /usr/bin I want to use them as normal terminal commands. Is it a good practice to use them with the .sh extension or can I save them without ...
0
votes
1answer
121 views

Can't install HoNClient-3.4.3.sh

I'm desktop user. My OS running 32-bit Ubuntu 14.04LTS. The problem I've run into is this: When I try to run the client in the terminal, using the command: sudo sh HoNClient-3.4.3.sh it gives me ...
1
vote
1answer
82 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
34 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
229 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
76 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
99 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
80 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
144 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 ...
9
votes
2answers
1k views

What does the first '.' mean in '. ~/.bashrc'? [duplicate]

I saw a post about fix your alias in .bashrc. And he says after you put your alias in .bashrc , you need to use: . ~/.bashrc I do not quite understand what the first dot(' . ') does here. What's ...
1
vote
0answers
36 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
89 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 ...
1
vote
1answer
166 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
38 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
34 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
101 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
147 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
62 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
170 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 ...
3
votes
1answer
3k 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
84 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 ...
1
vote
2answers
62 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
54 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 ...
2
votes
1answer
139 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
197 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
157 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
50 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 ...