A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

learn more… | top users | synonyms (2)

1
vote
0answers
18 views

-devilspie doesn't play nice with spawning new terminals

I'm trying to configure devilspie so that on detection of opening a certain directory it runs a script to mount that directory over a network. I don't think the script itself is too important but ...
1
vote
3answers
30 views

put split command and arguments on a variable in bash script

I have a script that repeat many times the same grep command, so i want to put that string on a variable making the script more readable for me, cutting the line length. This is the line (that repeat ...
1
vote
0answers
17 views

Creating and mounting partition automtically

I am running raspberry pi on raspbian wheezy, and I'd like to create script that automatically creates new partition on unused area of disk and mountpoints on it so it'll always mount on same ...
0
votes
2answers
42 views

viewing printf after pipe (or subshell?)

Ok, this is hard to distill to a single question because it really depends on how I'm going to troubleshoot it. The following script is meant to pipe mount.cifs commands to a while loop that enters ...
4
votes
3answers
272 views

Exiting a shell script with nested loops

I have a shell script with nested loops and just found out that "exit" doesn't really exit the script, but only the current loop. Is there another way to completely exit the script on a certain error ...
1
vote
0answers
7 views

Application started in /etc/X11/xdm/Xsetup can't receive key presses

I'm using xdm (and I'd like to keep it that way) for a project and I need a terminal to run a script before the login prompt. The script requires some user input, however, it doesn't seem to work. ...
0
votes
2answers
41 views

Why Are There Three Processing Running For One Script?

I have the following line in crontab. @reboot /usr/bin/teamspeak3-server_linux-amd64/ts3server_minimal_runscript.sh When I reboot, the script runs (i.e. my Teamspeak 3 server starts) in the ...
0
votes
1answer
40 views

A bash script that can automate git commit message contents

Normally when I commit a change to a submodule in Git (and if that's the only change), I will provide the result of git diff <submodule-name> to the body of the commit message (with ...
0
votes
1answer
18 views

Old file deletion script

I used this script: #!/bin/sh for file in "$( find /var/backup/web2 -type f -mtime +1 -maxdepth 1 -exec rm -f {} \; )" do rm -f $file done exit 0 to delete files older than 24h from fixed ...
0
votes
1answer
18 views

Substituting the value with spaces for a variable in bash script - the correct way

I have a compilation script that can compile the program with and without the debug symbols. I want to ask via bash prompt ( read ) the user to choose whether he wants a debug version or not with ...
1
vote
2answers
53 views

How do i search for certain sections of a file and then extract only relevant information within that section?

So I have a text file that is a server report and has about 1000 lines of information in it. I'm trying to write a script that can search the report for only certain pieces of information I'm looking ...
1
vote
2answers
28 views

Why does trying to run a python executable return ': No such file or directory' after transferring it to server via FTP? [duplicate]

I'm having an issue where when I transfer a Python file to my VPS via FTP and try to run it using ./foo.py I am returned with the error: : No such file or directory. The error seams to indicate that ...
3
votes
3answers
66 views

Converting rows to row groups

Can somebody please help me with the below conversion shell script ? Source File File 1 : for example EXCHANGE_ID : 192, 410, EXCHANGE_DTTM : ...
-1
votes
0answers
35 views

crontab is not working correctly while script itself calling other script [closed]

My requirement is to monitor below network elements with certain periodic time Network Element Instance Num Current Req. Maximum Req. Status ARSLAB 0 0 ...
0
votes
2answers
61 views

Bash script that detects if a file is the correct size

I'm trying to make this bash script dispatch and email when it detects that a certain type of file (files ending in ".gz"), which was last modified 24 hours ago, is below a certain size in a ...
1
vote
1answer
28 views

Application Shortcut To Launch On System Boot

I have a ts3.desktop file in my /usr/share/applications folder that I want to run on system boot. Can you please advise me on how this can be done?
0
votes
0answers
19 views

Can rpm call an external script stored somewhere in the package during installation?

I have a package which is being retooled for in house purposes. Mostly making changes to the configuration files. The files need to be somewhat dynamic so changing the config files at source isn't ...
1
vote
1answer
52 views

Bash script to edit text in csv-format

As part of an inventory bash script I am checking SFP modules and adding them to a .csv-file. The format currently looks like this, with varying lengths: RO01;1000BaseSX SFP;1000BaseSX SFP ...
3
votes
1answer
48 views

check for “errors” or “ORA-”

I want to check for "errors" or "ORA-" in Y.if there is an error then exit Y=`sqlplus -s user/passwd<< EOF exec test_Proc; exit; EOF` if [ echo $Y | awk '/ERROR/ || /ORA-/' ] ; then exit 1 fi ...
1
vote
2answers
62 views

How do I test if my variable is not in a set?

I am trying to modify the bash shell script and need some assistance. I have a directory with a bunch of files. What I need is to go through the files in a loop and if the file name not in a specific ...
1
vote
4answers
123 views

How to use and/or conditional in shell script

I have an if statement in a script. It looks like this: if [ "$a" != "0" -a "$b" != "100" ]; then #some commands here If I'm not mistaken, the line above will work if both conditions are true. ...
1
vote
1answer
62 views

delete multiple remote files with the FTP command

Right now we have a script that uses the FTP mget command to download all the files in a specific location. After after verifying the files have successfully downloaded we run a ftp delete command ...
1
vote
1answer
45 views

Is there a tool that automatically inserts and updates a script header block for e.g. shell or Python scripts?

I found scripts by a former admin who scripted quite nice things with Bash or Python. All his scripts are well formatted and equipped with a always similar looking "script header" or "code header", I ...
1
vote
2answers
32 views

Prevent certain lines of a script to run as root

Suppose I am writing a shell script that requires root privileges to run, for example- #!/bin/sh ip -s -s neigh flush all ufw enable How can I prevent certain lines of code to be run as root, i.e. ...
1
vote
1answer
34 views

Bash script to detect a file modified yesterday and check if its size is above a certain threshold

I'm writing a script to stat all files in a directory, and then find specific files that were created yesterday and tell me if they are larger than a certain size or not. So basically I need this to ...
1
vote
1answer
33 views

UNIX Script not reading the folders with spaces [closed]

I have a UNIX script which is supposed to scan all the folders and return the files older than speciific amount of time. I gave the logic as below, but the script is not able to read the folders with ...
-3
votes
0answers
39 views

Help with script to add new users and assign groups

!#/bin/bash User script Adds user echo -n "Username: " read user_name Creates password sudo passwd $user_name Creates group echo -n "Group: " read group_name sudo usermod -G $group_name ...
0
votes
2answers
24 views

Unable to perform a simple multiplication in script

I am havingf trouble performing a simple multiplication in my script. while read A B C do tmp=$A\*$C/100 echo $tmp >> out1.txt done < foo.txt foo.txt: 13721725 99 100 ...
0
votes
4answers
43 views

tabs in variable not working

I have this lines that i will insert in a mail called "header". header=" ------------------------------------- Name\tAge\tGender\tAddress ------------------------------------- " Unfortunately, the ...
2
votes
5answers
253 views

Bash script: check if a file is a text file [closed]

I am writing a menu based bash script, one of the menu options is to send an email with a text file attachment. I am having trouble with checking if my file is a text file. Here is what I have: ...
0
votes
2answers
41 views

while read loop

I have a file like one below var 3 2014 string var1 4 2011 string4 var2 6 1999 string2 var3 1 2016 string6 Then i have this while read loop to compare one of the ...
1
vote
1answer
49 views

Need help using Netcat

I have a file on my server that has HL7 messages spread out by a space. Example below. I am wanting to send one of these messages at a time in a continual loop until stopping the script with ctrl+c. I ...
0
votes
1answer
31 views

How to automate a webbrowser that supports javascript? [duplicate]

I have to automate the "imitation" of a "human" by using a webbrowser that supports javascript. I need it because there is a javascript link on the website that can be only used if the webbrowser ...
0
votes
0answers
27 views

CSH: Determine index number of string in an array

I am using csh. Consider an array of arbitrary length: set array = ( abc def ghi ) I have the following variable set var = "def" How can I find $var in $array and determine its index value? I ...
0
votes
3answers
58 views

backup script to copy files by its extension

I have created script to copy .png files from one directory to another. Script is as follows: i="`cat /usr/local/app1/default.conf | grep -i values | sed -e 's/\values=//g' -e 's/,/ /g'`" for data ...
0
votes
1answer
43 views

How to create a bash script that sees all files in a directory and tells me their size and date of creation?

I'm a beginner in the field of programing/coding. I'm trying to write a simple bash script that will see all files in a directory, and then tell me each file's size and each of their dates of ...
0
votes
0answers
17 views

Unable to execute root commands using client-connect option openvpn

I'm using the openvpn option client-connect to run a script when a client connects. The scrit works fine when I use simple commands but when I add commands that need root privileges it doesn't work ...
10
votes
2answers
117 views

Correct behavior of EXIT and ERR traps when using `set -eu`

I'm observing some weird behavior when using set -e (errexit), set -u (nounset) along with ERR and EXIT traps. They seem related, so putting them into one question seems reasonably. 1) set -u does ...
3
votes
3answers
36 views

printing a series of characters

My ultimate goal here is to generate a block of text that can be used to test out various fonts at a terminal. I want to generate the file as basically an ascii chart. A series of characters from 1 ...
0
votes
2answers
29 views

Script to find logs in directory

I have my loop for: for i in 1.34* do if [ -f $i/rela/*log ] ; then echo $i >> /tmp/allog else echo $i >> /tmp/alnolog fi done Is working well. We have different version of releases ...
0
votes
1answer
43 views

Host monitoring script with timestamp

I just made this script for host monitoring. The goal is to ping the host and log the output to a file but also to show output to the terminal. If the host is unresponsive it will log the time with ...
2
votes
1answer
56 views

Batch Extract & Repack .RAR Files

I'm dealing with a large amount of password protected .rar files which need to be repacked to remove the password. (The password is known.) I was wondering if there was a script to batch/recursively ...
1
vote
3answers
94 views

Script to move one filetype and create a subfolder, if it exists?

I'm trying to find a script that would basically look recusively at a directory, and if the script finds file that are .flac files, it will create a subfolder called FLAC in that same folder, and move ...
0
votes
1answer
33 views

How to grouped the following variable and command and read 1 by 1

I've following array and variable : httpurl="http://www.nnin.com" firstquery=$(curl -s -X POST -d "UID=user1&PWD=1111" $httpurl) name="firstcust" ip="105.105.0.1" httpurl="http://www.mmim.com" ...
8
votes
1answer
319 views

Know which process does I/O without iotop

On Linux, I want to know which process uses my disk I/O bandwith. I know I can use iotop but I have a machine where, for various reasons, iotop cannot be installed. How can I manually get that ...
1
vote
2answers
62 views

Script to Ping an IP and create a log showing date/time of any fails, times over 500ms, and traceroute any fails [closed]

Like the title says I am trying to make a script to run constantly that produces a log showing ping stats. I want the log to contain and ping fails, times over 500ms and the traceroute of any ...
1
vote
2answers
49 views

Substrings in shell script

Am trying to get a substring from a string but am getting the error: ${curr_rec:3:4}: bad substitution #!/bin/ksh get_file_totals() { if [ -e "$file_name" ] then IFS='' ...
3
votes
1answer
34 views

Auto disconnect from WLAN if unused

For Nokia N900 there is an app called AutoDisconnect which monitors the WLAN usage and closes the connection if the traffic is very low. I'd like to have something like this on my future notebook in ...
21
votes
5answers
1k views

How can I propagate my SSH pub key to a list of servers without having to type my password in over and over?

I was recently given username/password access to a list of servers and want to propagate my SSH public key to these servers, so that I can login more easily. So that it's clear: There is not any ...
0
votes
0answers
22 views

Script requesting information upon boot

The idea is to create a script that runs as root upon boot (either before a potential X or GDM starts or after). The challenge is that this script needs input from "the one at the keyboard" - without ...