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

2
votes
1answer
73 views

Stopping a running script though another script file

I am new to shell scripts. Say, I start a script like this. This runs for 3 days. So, I will start the script remotely through ssh and then close my local terminal. start.sh end=$((SECONDS+259200)) ...
0
votes
0answers
18 views

Reading from /dev/urandom outputs a list of files in the current directory; why?

So I was playing around with /dev/urandom, and trying to sample one random character from it like so: read -N1 < /dev/urandom I know there are other ways to sample some randomness like the ...
10
votes
4answers
691 views

How to display a random line from a text file?

I am trying to write a shell script. The idea is to select a single line at random from text file and display it as an Ubuntu desktop notification. But I want different lines to be selected each time ...
0
votes
1answer
30 views

How can I assign a keyboard shortcut for the script that I have created? [duplicate]

I don't wish to open terminal each time to execute my shell script. Is it possible assign a keyboard shortcut to execute the shell script I have created?
1
vote
1answer
34 views

How to assign a keyboard shortcut to show an Ubuntu Desktop notification?

What I am trying to do is, I have a few texts in a file & when I tap a key combination like ctrl+Q, the text should appear as a notification on my Ubuntu Desktop. What is the command to assign ...
0
votes
1answer
38 views

Link to shell script does not run from a different location

I have an application created using Lazarus. I can run it from the terminal like this: ./myapp para Now this file is currently in a home folder. So I created a shell script like this: #!/bin/sh cd ...
1
vote
1answer
24 views

Redirecting shell script output to a spreadsheet in sharepoint portal

I need to write a shell script that takes some statistics related to system and those values should be redirected to a spreadsheet in share point which then presented as a graph. Which is the best way ...
0
votes
2answers
50 views

Bash script special character and background job bug

gnome-terminal --tab -e " sh -c ' gedit'/media/ubuntuman/Onces And for Al/scripts/faceBook' & ; sudo cpulimit -e ubuntu-tweak -l 80;'" This is the piece of code I want to edit. The special ...
7
votes
5answers
588 views

stdin/stdout- How to send a file as an input to another file?

Through the command shell we can redirect the three standard filestreams so that we can get input from either a file or another command instead of from our keyboard, and we can write output and errors ...
0
votes
0answers
8 views

SOHO Network Scripts

I have a trying to develop two simple scripts to automate the set up of a small office with a Ubuntu server and workstations. I am likely in way over my head, but I am trying to do it anyways. The ...
2
votes
3answers
89 views

Writing a bash script to create PNGs out of SVG with Inkscape from a directory

I'm very new to bash scripting and I hope that someone can help me with that task. I have a directory filled with *.SVG-files and I want to batch convert them with inkscape to PNG with the following ...
0
votes
0answers
31 views

Install SystemC in Ubuntu 14.04 [closed]

Q : I want to install SystemC 2.3.1 in my Ubuntu 14.04. During the installation, when I enter make command, the below error occurs. (gcc 4.8 is installed.) What is the problem? /bin/bash: -c: line ...
0
votes
1answer
19 views

GCC Compiled program not running in a new Window

What i am Doing? I have created a simple c Program that runs and executes a system Command the code is as follows #include <stdio.h> #include <stdlib.h> #include <string.h> ...
3
votes
3answers
78 views

How to differentiate command from the output using color

I have to differentiate command from the output using color like this $ cat file-name (this should be in some color say like red) some test in file OUTPUT (this output should be in some other color ...
0
votes
0answers
18 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
20 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
80 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
28 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
67 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
29 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
30 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 ...
-1
votes
0answers
50 views

Initramfs menu!!!! How do i boot?

I restarted my pc after a update which said it had and error occurred, but did not affect any thing at the time. When it booted it went to a black screen and said: Gave up waiting for root ...
-4
votes
2answers
133 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
35 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
78 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
34 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
274 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
1k 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
47 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
21 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
280 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
28 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
19 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
178 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
80 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
35 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
45 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
35 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
41 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
56 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
241 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
111 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
32 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
28 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
29 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
55 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 ...