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

Count total no of functions in .h files

I want to have a count of total exposed functions in my module? I tried grep -rn "(" *.h|wc -l but I am not getting exact answer How do I count total number of global functions in my module?
0
votes
0answers
18 views

Dual booting thwarted by rogue keyboard presses?

End goal: successfully dual boot Windows 8.1 and Ubuntu 14.04, both are already installed and working. I just can't get to the bootloader (I think it's called) to choose to go back to my Windows ...
1
vote
0answers
39 views

Unable to connect to X11 display. is $DISPLAY set? - Yes, it is

I'm trying to run this in my /etc/init.d/rc.local. I had to manually add the exit 0 because it wasn't there by default if that makes any difference. cd /home/john/xcape && ./xcape -e ...
0
votes
2answers
52 views

if stament in shell script

How write in if [ -z $str1 && -z $str2 ], "&&" doesn't work, if write [ -z $str1 ] this is work. I want to once two string #!/bin/bash echo "Enter first string" read str1 echo ...
3
votes
2answers
208 views

For loop syntax bash script

Is there a way we can implement some thing like this in bash script ? pureips="10.3.1.111 10.3.1.112 10.3.1.114"; pureservers="a b c"; for ip,server in $pureips,$pureservers; do echo "$server | ...
0
votes
1answer
236 views

curl .gz file and pipe it for decompression

I am trying to download some .gz files (N.B. not .tar.gz ones) from given URLs and decompress them to overwrite existing files, if any. For each individual download, I tried the following: curl -O ...
0
votes
2answers
86 views

Copy a word from the html file of a web page using shell script

I am trying to write a shell script which should crawl into a web page and fetch a particular character/phrase from its html and display it. Particular character means, for example if the html of the ...
0
votes
0answers
41 views

Shell script to check url

I am trying to write a shell script to check for the existence of a particular directory in a particular domain name. For example, I have a web site named www.example.com. I want to check whether the ...
1
vote
2answers
30 views

Why sudo could not get the right PATH environment?

I run command sudo hadoop fs -ls /, it said hadoop command is not found. But I have already set it in /etc/profile, and also I verify it by switch to user root. What happens here ?
1
vote
1answer
54 views

How to create your own commands that can be used anywhere [duplicate]

I am new to linux, and I am learning bash scripting at the moment. I was wondering how I would save my script as a command and then be able to call that command anywhere in the terminal. So i could ...
0
votes
1answer
217 views

How to obtain and install shc?

shc is a compiler that compiles bash scripts into Linux executables. However, I can't find an official site and can't find it in the Ubuntu repos either. What is the official site, and why is it not ...
3
votes
3answers
464 views

For loop with unix find

Trying to do a mass convert from M4A to OGG in a large music collection, I have: #!/bin/sh for i in `find /home/family/Music -name *.m4a -print0` #do ffmpeg -i "$i" -acodec libvorbis -aq 6 -vn -ac ...
2
votes
6answers
1k views

How to command grep not to display the searched string? [duplicate]

I want to print a part of a line in a file. The whole line looks like this. Path=fy2tbaj8.default-1404984419419 I want to print only the characters after Path=. I have tried grep Path filename | ...
0
votes
1answer
509 views

How to fix invalid identifier error after setting environment variables?

I'm trying to setup cocos2dx in Ubuntu 14.04 LTS but after setting the environmental variables (in .bashrc) I start getting this error: bash: export: dev/cocos2d-x-3.2/tools/cocos2d-console/bin': not ...
2
votes
3answers
108 views

Search for a files that matches another file name in another folder

I have some files in a folder, which are named ***_code_c**** (where * represents any letter or number). I have another folder that have many files, folders and subfolders inside it. What I want to do ...
7
votes
2answers
556 views

How to do: underline, bold, italic, strikethrough, color, background, and size in Gnome Terminal?

How to do: underline, bold, italic, strikethrough, and color in Gnome Terminal? Bold Italic u̲n̲d̲e̲r̲l̲i̲n̲e̲ s̶t̶r̶i̶k̶e̶ ̶i̶t̶ ̶l̶i̶k̶̶e̶ ̶i̶t̶s̶ ̶h̶o̶t Color background font < (its mono ...
0
votes
0answers
424 views

Using a samba path (smb://server/…) to check if a folder/file exists

I have a samba path, f.e. smb://server/path1/path2/ which is located when mounted at /var/run/user/1000/gvfs/smb-share:server=server,share=path1/path2/. I can easily check via filesystem path if the ...
1
vote
3answers
177 views

How to get list of all non-removable disk device names (SSD/HDD and SATA/IDE only)?

I need a list of all disk device names (not USB or CD ROM) in the following form DRIVES='sda sdb' so that I can loop through them in a bash script. Ideal solution would not have to install a special ...
2
votes
2answers
267 views

CVE-2014-6271 over ssh example attack?

I've been reading about the CVE-2014-6271 bug on lots of pages, but I'm still not able to understand how exactly is it possible to exploit it over ssh. From all I've read, I couldn't find an example ...
0
votes
0answers
69 views

Comment text selection in Mousepad text editor?

Is there a keyboard shortcut, or a command, that I can use to comment a selection spanning multiple lines in Mousepad? This is language dependent, since comments in different programming languages ...
0
votes
2answers
215 views

shell script not running on terminal

I created a scriptA.sh on the desktop and make it executable then this was it content: #!/bin/bash sudo -u userA bash -c 'PACKAGE_PATH=/home/userA/package1; cd /home/userA/scripts' I want to double ...
2
votes
1answer
183 views

Execute command with relative (upper) path. Using another working directory

I need to run an application (msp430-gcc) using a relative path from a makefile. The issue is that the application is in a different folder branch so I need to do something like this: ...
0
votes
0answers
141 views

Trying to debug a code, need some help!

so I'm trying to run an installer and I'm getting this message: $ ./install Preparing installation files ... Installing ... /tmp/mathworks_4504/sys/java/jre/glnxa64/jre/bin/java: 4: ...
0
votes
0answers
68 views

Shell script loop stops by itself

I have two script files like this. execute.sh #!/bin/bash #259200seconds = 5 days end=$((SECONDS+432000)) x=0 cp /dev/null ~/kill_start.txt while [ $SECONDS -lt $end ] do [[ $(cat ...
0
votes
1answer
119 views

Run some shell files from another shell file in different location

I have 5 shell files in a specific locations on my ubuntu system. I have two users on this system userA which is the main user and userB. Currently I have to manually open a terminal using user userA ...
2
votes
1answer
670 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)) ...
3
votes
1answer
592 views

Why some server requires './' to run scripts but others don't?

I'm wondering why some Ubuntu servers are different. I have two Ubuntu 12.04 server which are running a web application. Today I tried to run an sh file from its folder. Server 1 can run shell ...
14
votes
5answers
2k 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
71 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
54 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
57 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
69 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
96 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
794 views

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
18 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
282 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
1answer
67 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
120 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
1answer
54 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
37 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
948 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
50 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
183 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
42 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
180 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
2answers
372 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
77 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
112 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
41 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
562 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 ...