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
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
39 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
46 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
57 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
245 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
145 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
35 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
32 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
32 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
59 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
418 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
66 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
29 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
60 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
100 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
70 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
33 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
145 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
65 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
80 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
72 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
86 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 ...
8
votes
2answers
1k views

What does the first '.' do 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
35 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
81 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
143 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
35 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
33 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
67 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
128 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
52 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
126 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
2k 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
71 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
60 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
53 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
130 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
151 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
102 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
47 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
624 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
51 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
92 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
62 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
73 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
115 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 ...