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)

0
votes
1answer
22 views

Using user defined function in bash scripts

I wrote the following script in the test.sh: #!/bin/sh compare() { if [ $1 != root ]; then echo "Fail" >> CAT1.txt fi } awk -F: '$4 == 0' /etc/passwd | cut -d: f1 | xargs -n1 -i bash -c ...
-4
votes
0answers
20 views

Run DB scripts in linux [on hold]

I want to run DB Scripts in linux but I am not able to do so . Can anyone give me the idea how to run DB Scripts? EDITED as Sybase is used in my project so what "isqlcmd" is doing I want to know?
1
vote
2answers
97 views

Bash script to read file and echo different lines to output files [duplicate]

I have a log.txt file with various lines of strings and information. I want to write a script to read the log.txt file line by line and any line that contains the word debug I want to put that line ...
0
votes
1answer
29 views

/bin/sh script error “arithmetic expression: expecting primary: ” + “ ”

ERROR: ./client-disconnect.sh: 22: ./client-disconnect.sh: arithmetic expression: expecting primary: " + " I just need to know how to fix it. It's for user accounting with OpenVPN. Script ...
1
vote
1answer
20 views

What's the Fedora equivalent of /var/lib/dpkg/info/[…].prerm?

Example file: /var/lib/dpkg/info/util-linux.prerm What's the Fedora equivalent of this file? (Not limited to util-linux - generic question for any package.) Use case: A prerm script is failing. ...
-3
votes
1answer
24 views

Need help running a command based on a file in the directory

I have some scripts setup that I would like a master script to call based on a files appearance in a directory. Basically I have what's show below. Script A uses file a Script B uses file b ...
0
votes
0answers
17 views

Script for changing monitor refresh rate when fullscreen on a specific website.

Premise I recently discovered this website where I can watch legal streaming of plenty of animes. They use a flash player and the CEO said that, for legal reasons, they can't use a HTML5 player. The ...
1
vote
0answers
21 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 ...
2
votes
3answers
40 views

Split command and arguments, and put into variable in a bash script

I have a script that repeats the same (very long) grep command many times. I want to make the script more readable by cutting the line length, so I tried to put parts of the command into variables. ...
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
46 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
280 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
29 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 : ...
0
votes
2answers
63 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
55 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
126 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
68 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
33 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
41 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
25 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
263 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
42 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
51 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
30 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
123 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
37 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
45 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
96 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" ...