Tagged Questions

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
32 views

Can't run script with proz on Ubuntu

I am trying to compile iOS code on Ubuntu. Trying to set up all tools according to: https://code.google.com/p/ios-toolchain-based-on-clang-for-linux/wiki/HowTo_en I get stuck on the point: ...
0
votes
0answers
28 views

Issue with running cgminer as a cron job - Ubuntu

I have installed cgminer in my machine and could able to start it without any issues when running ./cgminer in terminal. But for a specific feature, i am trying to invoke the cgminer from using ...
3
votes
4answers
236 views

making a bash script executable programatically

I need to create a bash script to create and mount a drive. So, two simple commands. Both "work" when entered at the command line. The script is created and executed every time a normal user logs in, ...
-2
votes
1answer
41 views

How to record user input to a file in a shell script?

My friend was showing me a program in shell script where he made where he would open the program, it would ask a question, he would type an answer. Then it would close but whatever he typed as the ...
2
votes
0answers
125 views

Shell command not asking for password inside while loop [closed]

I am trying to run .sh file to put certificate via keytool command in every jre/lib/security/cacert file described in ~/.java/deployment/deployment.properties file. #!/bin/bash ...
1
vote
0answers
37 views

14.04 update problem with executable file mode

Here's the problem: I create a file called foo.pl containing #!/usr/bin/perl as the top line I execute chmod u+x foo.pl I type ./foo.pl at the command prompt and get the following bash: ./foo.pl: ...
1
vote
1answer
63 views

How to find the path of a freshly mounted USB Drive dynamically?

I want a side script or a settings change that fires a second or primary script that does the actual work. I do not need to do it just for my computer. So it should work on any Linux computer. I need ...
-2
votes
2answers
261 views

How to write a script to “listen” to battery status and alert me when it's above 60% or below 40%?

I want to make a tool that alerts when battery is below 40% or above 60% so I can start/stop charging accordingly. I know some tools alert when battery is low, that's not enough. Is there a tool ...
0
votes
0answers
54 views

switching kde activities in command line

I started taking a course on bash scripting, and i'm still a newbie in bash scripting...please i wan't to know whether it's possible to control and switch kde activities in kubuntu via the command ...
0
votes
1answer
110 views

Is sim a shell script command?

I was creating a sym-link for practice in Ubuntu 14.04. I meant to use this command: ln -s ../fun dir1/fun-sym It was taken from a book I am using. Except I used sim at the end by mistake. So the ...
0
votes
2answers
36 views

End script and restart it with the same options and arguments

Usually !! repeats the last given command. But it doesn’t seem to work in a bash script. Is there a way to end a script and repeat it with the exact same options and arguments given the last time? ...
6
votes
2answers
354 views

Execute command from file in current shell

I want to executed command from file (which is script) in current shell in terminal. Example: I have file ch_dir contains following: #!/bin/bash cd /usr Now if I execute file usually as following ...
13
votes
4answers
2k views

What does /dev/null mean in a shell script?

I've started learning bash scripting by using this guide: http://www.tldp.org/LDP/abs/abs-guide.pdf However I got stuck at the first script: cd /var/log cat /dev/null > messages cat /dev/null ...
1
vote
1answer
58 views

echo command not giving correct output

I try to create output like 12DEC2013bhav.csv.zip in the script below. But it is giving me something like 12DEC.csv.zip instead: for (( i = 2013; i <= 2014; i++ )) do for m in JAN FEB MAR ...
1
vote
2answers
82 views

check if folder does not exist in tcsh

When using the tcsh shell, how do I check if a folder does NOT exist? I can check if it exists by if ( -d /folder ) then but I want the if statement to work for folders that don't exist.
0
votes
5answers
325 views

Compare strings in two files

I am trying to get the name of the user from one file and their corresponding details from my other file. I use awk: awk -F : '{ print $1 }' user-name it gives me the list of all the user's. So ...
0
votes
1answer
33 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
26 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
271 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
102 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
41 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
55 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
47 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
25 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
76 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
17 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
112 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
329 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
200 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
61 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
40 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
36 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
66 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
1k 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
89 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
44 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
74 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
145 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
110 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
38 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
327 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
99 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
117 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
89 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
250 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
38 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 ...