Script is series of instructions written in plain text file. The script interpreter (i.e. shell, Python, Ruby, etc.) can read this file and act on the instructions as if they were typed at the command prompt. The interpreter also provides a variety of useful programming features to make your scripts ...

learn more… | top users | synonyms (1)

0
votes
2answers
28 views

Difference between C programs and shell scripts receiving signals from fuser

I have written the shell script below for a lab in my college. It must look at a log file being upgraded frequently from another process and create a number of copies passed at invokation. Here is the ...
1
vote
2answers
109 views

Script to spread each file to its associated directory

The scenario is: I have a directory with thousands of pictures in the format YYYYMMDDXXX YYYY: stands for year MM: stands for month DD: stands for day XXX: stands for an ID of the picture, it ranges ...
0
votes
0answers
33 views

shell script in /etc/profile.d not running at startup [duplicate]

I have a shell script at /etc/profile.d/pg_local.sh. It contains the following contents: export PATH="$PATH:/usr/local/pgsql/bin" Its supposed to load that path in the user accounts' $PATH when the ...
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?
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
28 views

no echo in bash shell script loop

In this script, the second echo statement doesn't do anything. #!/bin/bash echo "Start folder create..." find . -name "*.zip" | while read filename; do foldername="${filename%.*}"; mkdir -p ...
20
votes
3answers
111k views

How can I make “rc.local” run on startup?

I have a script that I would like to run when my system starts. I have put it on "rc.local", but it doesn't work. How can I enable it to run on startup?
2
votes
1answer
94 views

Shell script with select command to show a list of files

I've written the attached bstls.sh shell script which uses the command select to choose the subfolder or file in a folder passed as argument on which execute the ls command. #! /bin/bash #Personal ...
0
votes
1answer
12 views

OpenNMS installation fails with error, Apt-Get broken

I was installing OpenNMS and during the install it fails with following error Preparing to unpack .../slpd_1.2.1-9_amd64.deb ... Stopping OpenSLP server: slpd. Unpacking slpd (1.2.1-9) over (1.2.1-9) ...
4
votes
1answer
69 views

How to execute a sudo script with double click

I have this script to shutdown my system after 30 seconds. I want to run this script by double clicking it (that option I changed in nautilus). This is the content of my script #!/bin/bash shutdown ...
0
votes
1answer
21 views

scripts in if-up.d not executed when ppp connection is created

I have a simple script "test" in /etc/network/if-up.d directory. The script contains below commands. It creates a empty text file, whenever an interfaces changes state from down to up. #!/bin/bash ...
0
votes
0answers
45 views

How to add and pass system password as a variable in a script

I have a script which asks for system/login password and pass that password to further processing. This is the gist of programm by which I am executing my script. read -s -p "Password: " password1 ...
8
votes
7answers
10k views

How to compare two files

So basically what I want to do is compare two file by line by column 2. How could I accomplish this? File_1.txt: User1 US User2 US User3 US File_2.txt: User1 US User2 US User3 NG Output_File: ...
0
votes
1answer
30 views

How to maintain a counter across multiple executions of a script?

I have a script with a conditional statement and I want to find out how many times the then clause is executed, across multiple runs of the same script. eg: if [condition] then Some code; ...
2
votes
0answers
23 views

error insserv with script

I try to install Unbound with the following website: http://www.unix-tutorials.com/go.php?id=3681 I copied the script : #!/bin/sh # # unbound This shell script takes care of starting and ...
2
votes
1answer
123 views

pdsh works well standalone, but doesn't work in script

I am trying to install hadoop via script on my small cluster [introduced in the book: Apache Hadoop Yarn]. I have set up ssh connect without password, and pdsh&pdcp are all fine if I use it alone. ...
0
votes
1answer
37 views

error in running bash script as root

I have a simple shutdown script which i want to run as root shutdown -h +30; echo "succesfull"; I have followed these answer1,2 to make my script root. first I run this command sudo chown ...
2
votes
2answers
59 views

How to monitor the status of shutdown sequence

This is the script I made to lock and shutdown my system after 30 minutes. #!/bin/bash # Read Password read -s -p "Password: " password echo # shutdown and screensaver Command echo "$password" | sudo ...
12
votes
5answers
30k views

How to round decimals using bc in bash?

A quick example of what I want using bash scripting: #!/bin/bash echo "Insert the price you want to calculate:" read float echo "This is the price without taxes:" echo "scale=2; $float/1.18" |bc -l ...
0
votes
1answer
23 views

How to schedule a script to be run as soon as the system is booted?

My laptop's touchpad doesn't work unless I enter the following commands in the terminal: sudo modprobe -r psmouse sudo modprobe psmouse proto=imps I could do this everytime I log in, but I want to ...
1
vote
2answers
21 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 ...
-2
votes
0answers
24 views

I Need execute a awk sentence on windows server [closed]

I Need execute a awk sentence on Windows Server, this sentence, read a file.txt, field takes column 4, and prints, I need run this sentence. thanks. Sentence:awk '/"Box11"/ { print $0 }' test.txt|awk ...
0
votes
1answer
44 views

How to change display's position from command line?

How can I use the command prompt to do get the setup shown below? Edit: I need the secondary display to be located to the left and half-way to the top of the primary display, as shown above. The ...
0
votes
0answers
13 views

Gui/Script to set up Wifi at login?

Wondering if anyone has tried setting something like this up before. I'm planning on shipping a product that runs ubuntu, and it will strictly need to be wifi only. I am wondering if there is a ...
3
votes
1answer
28 views

How to disable touchpad while running full screen applications / games?

Laptop support in Ubuntu is rather disappointing. It's like Ubuntu and Kubuntu are two different worlds. Is there a script to disable touchpad while running full screen applications? I tried to write ...
0
votes
1answer
28 views

How do I find out why I get anytime the same error message from an original Ubuntu script?

Swap2Ram.sh always produces its error message, even when I have enough ram left. Any ideas? #!/bin/sh mem=$(free | awk '/Mem:/ {print $4}') swap=$(free | awk '/Swap:/ {print $3}') if [ $mem -lt ...
1
vote
0answers
15 views

Screen in crontab

I'm trying to run 9 screens windows by crontab, and then, run some codes (basically the same for all of them), but they don't work. The code runs all of 9 screens, but run code only on the first. Aah, ...
3
votes
2answers
55 views

How to execute a shutdown with timer and screensaver command in a script

I made this script when executed will shutdown my system (after some time) and should enable a screensaver. #!/bin/bash sudo shutdown -h +30 gnome-screensaver-command -a There are mainly two ...
2
votes
3answers
349 views

Shell Script to block Ip addresses

Is it possible to write a shell script that checks connections in an apache server and blocks suspicious ip addresses with large number of connections automatically and fires a mail for it to the ...
0
votes
0answers
13 views

Enable Vino Script Help

I have been trying to add and enable Vino to our districts Ubuntu laptops but have come up with some issues that I can seems to find a solution to and i was wondering if you might be able to assist. ...
-1
votes
2answers
24 views

Startup Command

i would like to run this command after my network has been established when i boot up my ubuntu. the command in the terminal is : "mavproxy.py --master=/dev/ttyACM0 --baudrate=57600 --out=myipaddress ...
-1
votes
1answer
51 views

help with my script “path of shell” [closed]

I usually php but also use bash to automate tasks on my server. I am trying to test this bash script but I'm not sure what "path of your shell" means. If anyone could help me with what i am meant to ...
0
votes
2answers
3k views

How to add the logs to a crontab with time stamp

In crontab, I scheduled a daily backup script. Now when the cron executes the script the status are logged to a log file as shown below. 0 0 * * * /home/backup.sh > ...
0
votes
1answer
21 views

Execute scripts and Java programs from apache/PHP

I'm trying to allow apache and PHP to execute a script I have written that is located in /usr/local/lib the script in question is called "pathy" has been added to the path in my .profile, and I can ...
34
votes
6answers
47k views

How to execute a script just by double clicking like .EXE files in Windows?

How can I make a bash script executable by double clicking just like .exe files in Windows? I tried creating a launcher and assigning the script to it, but there are two consequences: the terminal ...
35
votes
11answers
114k views

How can I create a select menu in a shell script?

I'm creating a simple bash script and I want to create a select menu in it, like this: ./script echo "Choose your option:" 1) Option 1 2) Option 2 3) Option 3 4) Quit And according to ...
1
vote
4answers
29 views

What other ways to install ubuntu without using a flashdrive?

Curious about the other methods out there to install the operating system, Ubuntu. Thanks.
2
votes
2answers
81 views

How can I find windows of a specific application and place them into a grid?

I'm trying to write a script to identify all open chrome windows and move them into a grid layout on a large screen I'm not sure how to find out what the best resolutions would be so I was going to ...
0
votes
1answer
20 views

Does a user creating text file need to be in a specific place?

I've got several scripts which wont work for me but work for others. Their purpose is to add users to the system, and then assign them to groups. I wrote it as a nano bash file; does it need to be ...
4
votes
2answers
194 views

Script to extract/push a list of wireless configurations including passwords?

I need to configure a set of new machines. They all need a set of common WLAN connections I currently have on my machine. I know how to manually retrieve the settings including the passwords using the ...
2
votes
1answer
70 views

Stacking multiple for in commands

I'm operating on large amounts of data, and have a protocol involving several scripts. I launch it separately for each input file, simply swapping filename in text file containing the command. I would ...
1
vote
2answers
36 views

Creating a terminal from a shell script in Ubuntu

What is the name of the executable for the Ubuntu Terminal program? I want to launch a terminal from within another terminal. For example inside an XTerm I can write: xterm& How do you do ...
2
votes
1answer
65 views

How to make a batch file add users to groups?

I need help with a GCSE project, I'm stuck on the last question. It asks for a bash script to create users, and then assign them to groups. I've already made the script add new users, but I'm unsure ...
0
votes
0answers
38 views

Copy standard output to file

Script 1 uses echo (and other commands) to standard output. Script 1 also runs other scripts, which also use echo (and other commands) to standard output. Script 1 is called by a scheduler that ...
12
votes
1answer
443 views

How to get the PID of my script?

If I have the script "script1.sh" and I want to make it print its own PID as a first step. How can I do this in bash?
4
votes
3answers
708 views

Pipable command to print in color?

I'm a bit new to bash scripting, and I'm wondering if there is a program or built-in command to pipe to that will print in a specified color? Or is there an echo argument to do so? Like I could do: ...
-1
votes
0answers
22 views

How to display the 'percentage free' RAM usage using Perl Script? [duplicate]

I need to make a perl script which will display the percentage free RAM usage and the value should be able to be piped to another command. Appending into a text file should also be possible within the ...
0
votes
1answer
47 views

How to create a perl script which checks the system stats(CPU,RAM,HDD) and sends an alert mail? [closed]

The script is for adding to the cron tab. The flow of the shell script should be like this. 1. Checks the CPU state. 2. Checks the RAM usage. 3. Checks the HDD usage. 4.Sends an alert mail to ...
41
votes
7answers
29k views

Repeat a command every x interval of time in terminal?

How can I repeat a command every interval of time , so that it will allow me to run commands for checking or monitoring directories ? There is no need for a script, i need just a simple command ...
2
votes
1answer
49 views

Using awk command in perl script [closed]

Can somebody suggest how to use piping of commands in a perl script? Specifically commands that involve calling awk? I'm trying to create a perl script that will read disk usage using df -H and ...