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

Execute command on remote machine using telnet in one line

I need to write a script to monitor wlan0 interface of my remote machine. I can do this by executing iwconfig wlan0 repeatedly on remote machine. But how to login to that machine and execute this ...
1
vote
1answer
48 views

How to run streamus app from terminal

I use Streamus to stream music from you tube. I want to know whether streamus can be started from terminal itself. I have asked this question in main software site and the author recommended to use ...
2
votes
1answer
36 views

Is there a way to run a script every time I insert a usb modem?

I would like a shell script to execute each time I insert a USB modem. How would I do this?
-1
votes
0answers
11 views

how to compress 5 recent files in AIX 5L envirorment using a script [on hold]

I am a fresher and I would like some assistance, the task assigned to me is " to compress 5 recent files in AIX 5L envirorment using a script " among multiple files in a directory. I am new to ...
0
votes
0answers
17 views

Pass to the script keyboard key pressed after hotkey has invoked a Bash script

I assigned a custom hotkey Ctrl+Q to launch my bash script. #!/bin/bash read -s -n 1 key zenity --info --text "$key pressed" I'd like to have a script to detect which key followed the hotkey. Say ...
0
votes
1answer
38 views

how to create my own command on shell Scripting [on hold]

can you tell me how to create a new commnand on shell Scripting? thank you
0
votes
1answer
18 views

discover if other users are executing the watch command on the machine in which MyOwnCommand is beeing executed

I want to know if there are other users that are running watch on the same machine in which command X is being executed. How can I do that?
1
vote
2answers
43 views

Unzip a file to its current directory

I've figured out that extracting a .zip you need the path to the directory as well when you are recursively looking through subdirectories. So how do you store the path? This is nearly there but ...
3
votes
3answers
127 views

Store a filename in a variable minus the extension

File: test.zip Bash script while read filename; do zip_file=${filename} # do stuff done; Value stored in variable = "test"
-4
votes
0answers
30 views

chkrootkit result, am surely hacked huh? [closed]

/usr/lib/pymodules/python2.7/.path /usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/.noinit /usr/lib/jvm/.java-7-oracle.jinfo /usr/lib/jvm/java-7-oracle/lib/visualvm/visualvm/.lastModified ...
1
vote
2answers
22 views

Calling Values from a .properties file?

Right now I have a simple script I want to now call a .properties file and then print the results of that file, this is what I have so far #Specific Set Variables SpecficStatus="Pass" #SetVariable ...
3
votes
1answer
52 views

Ubuntu Touch: how to create a launcher to start a shell script?

On my bq Aquaris E4.5 I want to create a launcher button for the App Scope to start a shell script. Is there an easy way to create such a launcher?
1
vote
0answers
23 views

How to pass the line number, where the mismatch occurred in awk, to Shell variables?

I am trying to compare two csv files. I want the line numbers to be stored into shell variables or array. I tried something like this: paste <(awk -F, '{print NR,$1}' file1) <(awk -F, ...
0
votes
0answers
26 views

How to turn ON/OFF screen monitor using shell script and 'xrandr' linux command?

I am trying to turn on and off screen monitor in Ubuntu14.04 using key bindings. I tried following shell script #!/bin/sh output=$(xrandr | grep ' connected ' | awk '{print $1}' | head -1) ...
4
votes
2answers
331 views

How to create a rotation animation using shell script?

I looking for a script that creates a rotating animation using character /,-, | and \. If you continuously switch between these characters it would look like its rotating. How to make this?
2
votes
2answers
42 views

How to set environment variables separated by dots

I have to set an environment variable separated by dot in my tomcat startup script. For example host.name=localhost I know shell doesn't accept dot separated variables. Is there a work around ? I ...
3
votes
2answers
151 views

changing string with sed, where did it go?

$ cat test-paths.txt test/sub2/configuration.php test/sub3/configuration.php test/configuration.php test/sub1/configuration.php $ cat find-host-test #!/bin/bash for i in `cat test-paths.txt` do ...
1
vote
2answers
187 views

How can I use “find” in a shell script to search from the current directory?

I want the program to look like this : read a if[ find . name $a ]; then echo "You found the file" else "You haven t found the file" fi
1
vote
4answers
108 views

bash shell script

How do I write a bash shell script that requests the user's name, verify that it exists and, if it does, show the following information: Username: xxxx User ID: xxxx Group ID: xxxx Shell: / bin / xxx ...
0
votes
0answers
21 views

Bash script not creating screen

I have a script that I wish to run on a screen. The screen that already exists is killed correctly, however the screen is not created and the command not run. Any ideas? #!/bin/sh screen -S attorney ...
0
votes
3answers
74 views

for loop syntax in shell script [duplicate]

I run below script: for (( i=1; i <= 5; i++ )) do echo "Random number $i: $RANDOM" done I am getting below Error: Syntax error: Bad for loop variable why this syntax is not working?
14
votes
9answers
642 views

How to write a shell script to assign letter grades to numeric ranges?

I want to make a script that would prompt you for a number between 0-100 and then give you the grade based on the number. I'd like it in bash. PS3='Please enter your choice: ' (Something here) do ...
-1
votes
1answer
39 views

Command to delete a file? [duplicate]

The title says it all. I am trying to write a shell script that deletes a persistent but unnecessary folder in my home directory upon execution. So, I ask you fellow Ubuntu users, what is the terminal ...
0
votes
2answers
63 views

Executing root commands without root password within a shell script [duplicate]

Is it possible to write a shell script in which we can include the root commands, and execute it without entering the root password over the terminal.
3
votes
2answers
71 views

Ctrl+C command is not terminating infinite (while) loop

I have this little script. When I start it and the terminal has the focus Ctrl+C stops feh and then the while loop starts feh again. I am expecting that, as long as the terminal(!) has the focus, ...
-1
votes
0answers
15 views

using text browser on linux to display proxy information [duplicate]

I have this question on my project , and can't how can be answer it , could you help me? how can store proxy information Permanently for a text mode browser such as links? I want steps , if you can. ...
0
votes
1answer
30 views

Is it possible to edit the .bash_login file for the second time?

I accidentally wrote an error command in the .bash_login file. I need to edit the file to solve this problem but I can't do that anymore. The error is about the .bash_login isn't a writable file ...
0
votes
1answer
25 views

How to remove index.php from each folder and subfolder?

My server got hacked and in each folder and subdirectory index.php was placed. I removed index.php in main folders and was able restore my website. However hacker placed index.php in each ...
0
votes
0answers
18 views

Loop not getting exicuted for a particular date

I has a file with dates of the formats "2015-04-10" and "Apr 20". so i wrote this piece of shell script to extract the lines matching a date and store it in a separate file. the date is given in ...
0
votes
1answer
22 views

ambiguous redirect

The error is: line 20: $1: ambiguous redirect what could be the problem #! /bin/bash while read line do string=$line array=(${string//,/ }) fileName=${array[0]}_"final_fitness.out" ...
5
votes
1answer
123 views

Bash always evaluate Regex as true

In a script, there's these lines #!/bin/bash ... if ! [[ $SCREEN_NAME =~ ^[a-zA-Z0-9_.-]+$ ]]; then echo "The Server title contains invalid symbole. Only a-z A-Z 0-9 - _ . are allowed" exit 1; ...
7
votes
3answers
199 views

How can I start up an application with a pre-defined window size and position?

I'm wondering is there any way to achieve the affect of the Ctrl-Alt-Keypad shortcuts in Unity using terminal commands instead? I want a command that sets a gui window to half the size of the screen, ...
0
votes
0answers
5 views

QJoypad profile switch on program close

I've just started playing with qjoypad on my ubuntu HTPC. I like it because it lets me use my xbox controller as a mouse, and switch profiles. I've read that xboxdrv lets you do the same, but I've ...
2
votes
1answer
39 views

Reset hibernation delay from command line

My hibernation on Ubuntu 14.04 LTS works fine. But someone keeps changing its delay to never hibernate. I am tired of paying days' worth of electricity for 10 minutes usage a day. Is there a way I ...
1
vote
1answer
29 views

Script that prevents the software to run unless other associate software is already running

I have a situation here. We wanted to prevent a software to run successfully unless the other software is already running. If the script has been run, it run the main software and it will check if the ...
1
vote
3answers
147 views

How to run a shell script on Ubuntu-touch?

I want to run a shell script on my "bq Aquaris E4.5 Ubuntu-Edition" phone in the Terminal App and created a shell script in /home/phablet/Documents/sync.sh #!/bin/sh # sync contacts and calendar with ...
1
vote
1answer
49 views

How to autostart a shell script on Ubuntu-touch?

I want to start a shell script on my bq Aquaris E4.5 Ubuntu-Edition whenever I switch on the phone to syncronize my calendar and contacts via syncevolution with my owncloud server. How can I ...
0
votes
0answers
30 views

How to press ENTER in Nano on Ubuntu-touch via abd?

When I'm connected to Ubuntu Touch (bq Aquaris E4.5 Ubuntu-Edition phone) via adb shell and I'm editing a shell script with Nano. How can I press ENTER to save changes? Nano does not accept the ...
1
vote
1answer
23 views

Script that put filenames at working directory in text files with some additional strings

I need to make a script that put filenames at working directory (with specifical extension) in text file with some additional strings: For example: if I interested in files with extension "i" and ...
5
votes
2answers
99 views

How do I tell a shell script my password?

I've been trying to create a script that runs sudo apt-get update and sudo apt-get autoremove whenever I log in. It goes like this: #!/bin/bash (sudo apt-get update) (sudo apt-get autoremove) But ...
4
votes
3answers
216 views

How to use double substitution in awk?

To print the fields at 29th column in two files I used paste <(awk -F, '{print $29}' PreRefFile.csv) <(awk -F, '{print $29}' Txlog.csv) This worked fine. To print all the fields starting from ...
7
votes
7answers
613 views

Exit terminal after running a bash script

I am trying to write a bash script to open certain files (mostly pdf files) using the gnome-open command. I also want the terminal to exit once it opens the pdf file. I have tried adding exit to the ...
0
votes
1answer
28 views

How to compare float variables in awk?

awk -F, 'NR==FNR{c[$29]=$29;next} NF{print $29 ((c[$29]==$29)?" ":",mismatch")}' $file1 $file2 The value of 29th field, i.e., $29 in file1 was 832.9 and that of file2 was 832.9000. If I compare them ...
0
votes
3answers
46 views

Problem when trying to run shell script : No such file or directory

I'm trying to run the following command on bash: ./home/abcdef/Desktop/jikesrvm/dist/prototype_x86_64-linux/rvm which is giving me a bash: ...
-1
votes
1answer
67 views

How to create logfile for a bash script?

I've written a bash script that runs multiple instances of a program and would like to write the entire output of the script to a logfile. I tried #!/bin/bash touch <.../somewhere/logfile.log> ...
0
votes
0answers
19 views

How to store last email in a file?

I wanto to set my bash detecting incoming e-mails and maybe execute commands in the emails, detecting programmed regular expresions, what commands does let me to do this? I'd like to have a solution ...
1
vote
3answers
52 views

Force “bad” (not 0) return code of terminal command?

I have a framework written in python, and for testing purposes I basically want to do a subprocess (aka shell call) ... that should simply come back with a RC != 0. I tried to invoke some non-existing ...
13
votes
1answer
649 views

opposite of eject command?

I have a ton of CDs to image, and I just got curious. I can eject with the eject command. What command inserts the disk tray back into the CD drive? yes it is the type that can pull the tray back in. ...
4
votes
3answers
279 views

improve bash script

I have a quad core desktop, and i wanted to know the average temprature according to sensors. so i wrote this bash 1 liner. echo `sensors -A | awk {'print $3'} | sed 's/+\|(crit\|0:\|°C//g'` | awk ...
0
votes
1answer
30 views

how to stop using export command

every time I run gdb I have to type export SHELL=/bin/bash or gdb would return exit with code 127 my question how to make this command run every time automatically without need to re type it because ...