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
2answers
41 views

How to loop a script over many files?

I have Gnuplot script (exe), inside this script I supply X_001 as an input file to be plotted by a certain function giving output file with X_001.png. It works well if I manually put the name of the ...
-1
votes
0answers
15 views

I am trying to write a printf statement into a script to output some record with padding option (columns)

Here is my data file called: bblack|Black|Brian|P|5|sun lbanas|Banas|Kerry|S|5|mercury dholder|Holder|David|S|5|venus dives|Ives|David|W|5|earth slambert|Lambert|Scott|S|5|mars rtaylor|Taylor|Rich|S|...
0
votes
0answers
10 views

Create a security copy plan: script and crontab

Hello I would really appreciate any help with this excercise to learna little bit. I want to create a script and the crontab to make a backup of /home, /var and /opt. I need to copy files only if ...
2
votes
2answers
92 views

Read file line by line and put in other string

I want to read file line by line and put its content to other string in specific place. I have created the below script but unable to put file content in that string. File: cat /testing/spamword spy ...
0
votes
0answers
18 views

`Unhandled Exception: System.ArgumentNullException: Value cannot be null.` error while running `dotnet run` using a startup script

I'm trying to run a dotnet app using dotnet run --configuration Release at system server Startup/Reboot. I'm using a init.d script to acheive the same. My startup script, located at /etc/init.d/...
0
votes
0answers
8 views

Scripting U-Boot bootorder and using bootable USB device

I'm trying to configure U-Boot to make it have a boot order. Using environment-variables, I must make it choose which partition to boot on. I also need to boot on USB if a bootable USB device is found....
0
votes
0answers
14 views

How can I run a script at boot that runs a program as user

I already got my script (in python) to run at start by placing it at /etc/init.d/ . This scripts will eventually start GUI with startx or RetroPie with emulationstation commands, but it won't work ...
0
votes
0answers
3 views

Script not running but commands execute on terminal with python (gnomekeyring.IOError) [on hold]

I am trying to unlock one keyring using the library gnomekeyring in python. I have written my script, but it throws me the error gnomekeyring.IOError. However, if I run python at the terminal and ...
3
votes
3answers
34 views

Delete lines that contain the same information but in different order

Let's say I have two lines( in a txt file) Monday, Tuesday, Week Tuesday, Monday, Week They contain the same information, but the information(the first and second column) is in a different order in ...
0
votes
1answer
35 views

Show pairs of files with same m5dsum

I need to calculate md5sum of all files in a directory and print them in a line if their md5sum is same. for example, if we calculate md5sums: file1, md5sum abcdefgh file2, md5sum 21safdsg file3, ...
1
vote
1answer
32 views

Pass Shell variable to awk [duplicate]

I realize this has been asked many times and many of the answers seam well written, but I'm missing something with my little task. Trying to pass a Shell variable (an argument in this case) to awk to ...
-2
votes
0answers
19 views

My folder structure is MAIN/FOLDER1/YEAR/MONTH/DATE/files now I want to delete the folder which was created a day before

My folder structure is MAIN/FOLDER1/YEAR/MONTH/DATE/files.Now I want to write a script that deletes the folder of previous day's date? Please guide.
0
votes
0answers
30 views

How to log out of the system using a bash script

I went about making a small script that requires an extra passcode when logging into my account on the system. #!/bin/bash clear unset password prompt="Enter Passcode: " while IFS= read -p "$prompt" -...
1
vote
1answer
29 views

View script output over ssh in real time

I am trying to run a local script on a remote machine with ssh. Let's say this is the python script (printdelay.py) which I am trying to run: from time import sleep print("The first line") sleep(...
-1
votes
1answer
35 views

Append value as parameter to shell script

I found the value of a response (curl) with sed and now i need some help to take the value that i printed in a file and to use it in another substring in the same .sh script This is the response of ...
1
vote
1answer
19 views

Unix Solaris script for executing commands in multiple remote hosts

I am new to the Unix and want help to create script, I have two hosts for eg. 1) 00.00.00.01 having regions on diffrent ports for eg. a) a1region (port 0011) b) b1region (port 0012) c) c1region (...
0
votes
1answer
31 views

parse a really simple markup grammar with a shell script

I have to parse a file, kind of a config file, that is adopting a really simple grammar : there are 2 kind of multiline blocks and inline markup tags . the block of type 1 is marked by an open_tag ...
0
votes
2answers
20 views

Usage of consecutive variable names in a script

I want to do some simple calculations with variables in an script.sh, in the same directory there is a folder called New Folder2. So, I want to enter into the folder and save a text file. The script ...
1
vote
1answer
36 views

Why can't I execute this script?

I am trying to execute a script to determine its system running time and potentially fix its problems. If I type: {hostname@bankofamerica]$ ./xx-xxx-xxxxx.sh [sudo] password for hostname: _ It ...
1
vote
2answers
29 views

combining 3 separate arrays to one multidimensional array in bash

Is possible to create multidimensional arrays in bash scripting? These are my 3 arrays: arrayCITY=( NewYork LasVegas Detroit ) arraySTREET=( RoadStreet TreeStreet HighStreet ) arrayNUMBER=( 20 455 ...
0
votes
2answers
32 views

Trying to figure out Linux script

I am a fairly new Linux user and I am trying to put a script together for a class. The script is supposed to allow a user to type in a username, and it will say if the username exists or not. If it ...
2
votes
3answers
70 views

awk system call with inverted effect

I have a data file with multiple data blocks enclosed between specific keywords (DATA,END). I am using awk to extract the data blocks into separate files, based on a file name taken from said block. ...
-1
votes
0answers
29 views

How to run shell commands at startup [closed]

I am using openwrt on my board. At startup, I need to run command for taking serial data and send it to an IP. The command is: socat FILE:/dev/ttyUSB2,b57600,raw,crnl, TCP:192.168.1.1:5001 How do I ...
1
vote
4answers
64 views

How to check if a variable entered is alphanumeric or not in ksh?

I am using ksh on AIX and I want to check if a variable, for example var1=sanySAN, var2=SANYsa%$3 is alphanumeric or not. Here, var1 is alphanumeric and var2 is not. I know I can use [a-z][A-Z][0-9] ...
0
votes
1answer
11 views

Replace an open bracket ( with !( Only at a specific location wrt a -> symbol

I want to replace only a specific bracket with not of that bracket i.e !( And this bracket should be the one right before this -> sign in each line of the file. For instance, (A & b) -> (b &...
4
votes
4answers
56 views

List files not stored in Git repos

I want to find out what files in a certain directory are not managed by Git. This is so I because I use Git for backups, and I want to eventually get all my files personal in there. What unix tool ...
0
votes
1answer
27 views

Check if multiple directories exist with bash script [duplicate]

I have a file with a list of directories and I need to find out if they actually exist on the system. It's quite a large list so I'd like to figure out how to automate the check. The file is ...
0
votes
4answers
60 views

How to use as argument the characters + , - , x , / in a script [duplicate]

I am trying to write a script I will call calc.sh that does basic calculations using the arguments for the script ( $1, $2 and $3). For instance I'd like to get 2 as result for ./calc.sh 10 / 5 My ...
3
votes
5answers
91 views

Get the query string from URLs in a log file

I have a server log file that contains a number of log entries in the following format: 193.1.172.46 - - [23/Mar/2008:03:57:38 +0000] "GET /robots.txt HTTP/1.0" 404 289 "-" "gsa-crawler (Enterprise; ...
3
votes
1answer
40 views

Problem with strongSwan

I have a VPN server with Ubuntu and IKEv2 protocol using strongSwan. We create clients using the bash user.sh script, but we have a problem as shown below. When the number of clients increases - to ...
2
votes
1answer
27 views

Record of highest NF

Using awk for the following input file, how could I take the record with highest NF for the same last field. File: 5541,55004,919843,IND 5542,5541,55004,919843,IND 7903,790287,RUSE 7905,7903,...
1
vote
2answers
29 views

How to automatically run a script when I connect a bluetooth device?

I have a bluetooth headset and I need to execute a .sh file everytime I connect it to make it work. I don't want to troubleshoot this bug since I know there's already people looking into it. But I'm ...
1
vote
1answer
30 views

Match EXACT string in file and update IP Address

There two steps, first check if exist the host in the file If have the file: # FILE: /etc/hosts: 192.168.0.10 srv-db srv-db-home 192.168.0.15 srv-db1 192.168.0.20 srv-db-2 192.168.0.20 srv-db-work ...
1
vote
0answers
22 views

Ansible, trying to find a way to force a task time out on a host it's currently operating on

Concerning Ansible, this should be fairly straightforwards I hope: Scenario: I have 3 servers, red, green, and blue. I have a task created for ansible to use yum in linux to install a random ...
0
votes
2answers
48 views

How to list all zip files in a directory? [duplicate]

Ubuntu 16.04 I tried this: for file in $source/*.zip do echo $file done and it works if the directory contains zip files. It prints out all them. But if it does not, it just print the $...
1
vote
0answers
15 views

Warn in crontab if command has failed multiple consecutive times

I have a command in my crontab to monitor a service (specifically, check whether the Tor version of my website can still be accessed): this monitoring command succeeds if it can access the site, and ...
1
vote
1answer
16 views

How to measure time of multiple commands in background?

I have a shell script with multiple commands and I want to run each command in background, so I put an & at the end of each command. I need to measure how much time execution of all the commands ...
3
votes
2answers
52 views

Create a script to identify those users who have not logged in the last 15 days

I have doubts: The exercise is: Make a script to detect users who have not logged in in the last 15 days AND belong to group "alumnos". The list will be added to /var/log/alumnos_sin_login. My ...
0
votes
3answers
46 views

How to run bash script as long as video length?

How to run bash script as longs as video length? I will set up a cron to start bash script at 7PM, and I want to keep it running for as long as video length. How to do It? Example: 7PM bash scripts ...
0
votes
0answers
35 views

Restart a running process if it outputs a particular string?

I want to loop a process in a bash script, it is a process which should run forever but which sometimes fails. When it fails, it outputs >>747;3R to its last line, but keeps running. I tried (...
3
votes
2answers
52 views

Expect script for copying file

I am trying to move/copy some files from my local machine to another host which I am able to access via ssh. But unfortunately this below script is not working. when I run this script it is asking me ...
3
votes
4answers
66 views

How to move a file recursively based on size and keep structure

I want to move files bigger than "300Mb" from one directory tree where each file is located in subfolders Example: I have a directory structure: dirA/ dirA/file1 dirA/x/ dirA/x/file2 dirA/y/ dirA/y/...
0
votes
1answer
28 views

How to read simultaneously from two files and print them line by line, bash? [duplicate]

I want to write an script which has as arguments two files F1 and F2 and prints them alternatively; first will be written F1's first line, then F2'2 second line and so on. If one of them has less ...
3
votes
0answers
41 views

Perform dig on two lists

I need to run a dig on domains and these domains aliases, so the result will be: IF domain (+ doesn't have an alias) and is using my Name Servers -> then print out IF both domain and alias are using ...
2
votes
3answers
39 views

Piping a command's output to a variable in body of awk script

Given inputfile Cherries:20:100:300 Beans:12:400:500 Tomatoes:32:445:234 Potatoes:24:400:200 Kiwis:23:230:435 I have an awk script, named testscript.script: BEGIN{ FS = ":" print "-----------------...
1
vote
1answer
24 views

Extract two values from files

I would like to extract two values from a series of .txt files. This is the last two lines (line 49 & line 50) of my .txt file 1 13593 3434 2.2585 0.9 2 3333 333 3.7118 0.8 & I want ...
2
votes
1answer
77 views

Creating script with looping in same screen

I have one simple problem, with my script, I need row script in same screen and does not display last information above, see my demo code: #!/bin/bash if [ -t 0 ]; then stty -echo -icanon -icrnl ...
1
vote
0answers
13 views

Multiple spreadsheet from one xls [closed]

Can we create one multiple spreadsheets from different xls file using shell script. I created using xml in shell script using , But the one spreadsheet will open when all the xls files are present in ...
0
votes
1answer
20 views

execute command on a host from a file with a user from another file

I am trying to create a script that would login to each server from a list with a user from other list and execute a command. How can I do this by taking the first host from the file and login with ...
0
votes
0answers
31 views

Why can't I print to terminal with my python script? [migrated]

I can't figure out why I can't print to the terminal using the following code. #!/usr/bin/env python3 import sys def main(): sys.stdout.write("Hello") I'm running the program from the terminal ...