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 (1)

1
vote
1answer
72 views

script needs to add another loop

script which runs netstat -tulpun | grep -i port_from_the_list & takes the output for running the next command I need to run 2 command on all the server mentioned in the list. server: Jan port: ...
1
vote
2answers
30 views

remove lines from an output file from diff

I have a script that uses diff -c then puts the output on a text file. What I want is to remove the line that does not have the "!" and display the lines with the exclamation mark. Is this possible? ...
-1
votes
2answers
45 views

Script which takes details from file & runs command

It would be helpful to understand how can I connect the second column in the script. currently using the below for loop for i in cat server do echo ===$i==== ssh -q $i 'netstat -tulpun ...
2
votes
4answers
111 views

Fastest way to read last line within pattern of multiple files with the same extension

I have in a directory /home/files/ some files that all have the same extension .txt. For example 1.txt 2.txt 3.txt 4.txt 5.txt test.txt These files are all the same in data format but the data are ...
1
vote
1answer
32 views

I'm copying if-then statements, with slight variations… and I shouldn't have to

I know there's a better way to do this, I'm just not looking in the correct place to figure it out. I have a number of these type of statements (say 1-100, or a list of different filenames). ...
0
votes
1answer
83 views

How do I put a checksum in a script?

I was (am) having trouble installing Eagle on my Linux (debian 8 jessie) computer. I was reading the installer script, when i noticed there is a checksum for the install script in the install script? ...
0
votes
2answers
60 views

Whats wrong with this case statement?

UPDATED: I am trying to do some color changes with my keyboard using apexctl depending on what time it is. But my case statement is giving me trouble. I want to compare the time when the script runs, ...
0
votes
0answers
19 views

What's the difference between `set` and `modify` in *nix command syntax

I'm creating a new custom script that will be able to add, modify|set and delete certain rules of DNS records. I was looking for a proper naming convention of *nix tools that might help me name the ...
2
votes
2answers
48 views

Changing variables in a forked process from outside that fork?

In theory with this block, you should only see "running..." once(or less), but in practice, it repeats until it's manually killed. How do I change the value of x inside the forked process to false ...
1
vote
3answers
126 views

Can I make [ $(($1 % $check)) -ne 0 ]; be more performant and not be killed?

If have the following code which works for up to 13 (line 2) in a few seconds but when I try and do upper teens and 20 it gets killed after a couple of minutes. divisible_by () { for ((check=2; ...
0
votes
2answers
340 views

VLC script on ubuntu server

I need a small script which run three vlc command on the same time (on Ubuntu server 14.04) as stated below: #!/bin/sh cvlc -vvv v1 --sout ...
0
votes
1answer
74 views

How i make this script execute every minute without cron? [duplicate]

I have this: #!/bin/bash wlan=`/sbin/ifconfig wlan0 | grep inet\ addr | wc -l` if [ $wlan -eq 0 ]; then echo wlan0 not connected, connecting... echo sudo ifup wlan0 logger wlan0 reconnected. echo ...
0
votes
1answer
30 views

Disable log of specified crontab item

How can i disable logging for specified item/line in crontab? (i´m on debian/raspbian) I have a script that checks if wlan0 is up every minute, but i don't like that cron logs every minute on syslog ...
2
votes
0answers
51 views

Bash Executing Script from within Script Causes Echo and Read Issues [closed]

I appear to be having unexplainable issues with scripts run from within a subscript. I've been unable to acquire a solution so I will give you what I can to help me solve it. Problem: when a script ...
0
votes
1answer
73 views

bash shell - how to do nested loop without “syntax error: operand expected” [duplicate]

I am trying for i in {4..100} do is_prime=true a=$(($i-1)) for divider in {2..$a} do b=$(($i % $divider)) # <-- line 9 [ $b -eq 0 ] && echo 'y' #is_prime=false done [ ...
5
votes
1answer
171 views

echo colored text which changes colors dynamically

Is there any way that i can print a colored text on console which keeps on changing its colors dynamically(with or without a specified time interval) just like some greeting cards in which the ...
0
votes
1answer
55 views

file deletion using forfiles

Trying to delete files in directories named "archive". I have not been able to figure out how to do this without specifcally entering every directory. There are other directories under the serial ...
1
vote
1answer
44 views

file name as argument and sort in descending way in perl?

I have this perl script #!/usr/bin/perl use strict; open my $df, '<', 'file.txt' or die "open: $!\n"; my %h; while (<$df>) { $h{$_}++ for split /\s+/; END{ for (keys %h){ ...
1
vote
2answers
105 views

Checking URLs for HTTP code 200

I have a text file containing a list of URLs like this: http://somesite.com/some-article/ https://anothersite.fr/somepage.php?page=something What I'd like to do is check which URLs return HTTP code ...
1
vote
3answers
142 views

How to send input in a new terminal using Shell Script

I found out how to automatically send input to a C program using Shell Script. For example, if I compile this C program: //test.c int main() } int x; printf("Please enter an integer:"); ...
1
vote
0answers
23 views

OCR for getting text from an image. Error management

I want to use an OCR program to obtain some text in an image. The text is not black on white so I don't know if it will be possible. wget -q -O image ...
2
votes
3answers
60 views

Pipe files downloaded with wget into a function

I'm downloading a bunch of images with wget and I want to rm the files if they are empty with a function to which I can pass the file. My question is how do I pipe the images to a function like this: ...
0
votes
2answers
50 views

Copying two words from a string into two variables

I want to get the variables $color and $number from a string that in general is like this: "something, numColor (number)". The color might be W, U, B, R, G. If there is no color the variable color ...
4
votes
5answers
229 views

how to split file and lines

I have a text file like : 1_01 { ; quite good spirals reset=2000 type=mandel passes=1 corners=-0.6014129278/-0.5990935452/0.427747516/0.429487053 params=0/0 float=y ...
1
vote
1answer
14 views

Automatically find position, from what last command started in tmux

It is common practice in tmux to start some command, then switch to copy mode, scroll to the position, where is this command started and look over the command output. It is difficult to find the ...
10
votes
3answers
399 views

How do I do an N-way diff?

How do I diff the output of multiple commands? vimdiff can support up to four files, but diff itself seems to support exactly two files. Is it directly possible with some variant of diff, or do I ...
2
votes
1answer
88 views

Problematic bc calculation in shell script

On Ubuntu 14.04.1 64-bit LTS I am writing a shell script and if I define the start of the sequence used in the for loop with a variable instead of a constant I get really weird behavior and there are ...
1
vote
2answers
127 views

Read Command : How to verify user has typed something

I am a beginner in Bash so please bear with me. I'm trying to create an if else statement to verify that the user has entered something. If they have it should run through the commands, and if not i ...
1
vote
1answer
55 views

let script find path of itself

I want to have a bash-script discover its own path. The background is that I have a script called process_scanned_text.sh, which itself uses the script curves. I put curves in the same directory as ...
0
votes
0answers
12 views

Creating a bootable 'system profiler'

I'm trying to create a program using a small linux distribution that can be booted from a USB (kinda how DBAN operates). The program with simple output system specs upon request, no GUI, simplicity is ...
0
votes
0answers
11 views

pop up panel applets

Im using debian 7.7 with gnome classic fallback mode I like how I can put programs and scripts into the panel in custom application launchers. What i want to do is have an analog xclock is fine, in ...
0
votes
1answer
43 views

How to change date format and position in find output

Sorry if this a basic question. Say i have the following command. It's set to display a list of the last 20 files modified on my drive with the paths included. find -type f -printf '%TY-%Tm-%Td %TT ...
-2
votes
3answers
86 views

How to list filenames within a folder based on a pattern supplied?

I'm trying to find a command that will list all files in a folder containing a keyword that is inputted. I've tried grep -l but it will not list anything
3
votes
1answer
62 views

Retrieve X11 window ID of a just-launched GUI-program

I want to retrieve the X id of GUI programs I launch in background, in order to work on their windows properties. I've been so far using this workaround: myprogram & sleep 1 winID=$(wmctrl -l | ...
1
vote
2answers
158 views

script to add users to otrs

Im looking for a fast way to import customer users into otrs (ticket system) I have an export from Active Directory with: firstname lastname password email username There is a script in the otrs/bin ...
2
votes
2answers
264 views

Using Diff on a specific column in a file

Will it be possible to use diff on a specific columns in a file? file1 Something 123 item1 Something 456 item2 Something 768 item3 Something 353 item4 file2 Another 123 stuff1 Another 193 ...
0
votes
1answer
144 views

Create A Script That Responds To A Password Prompt

I'm writing a shell script that will respond to a prompt. For example, when I execute a file, the executed file will then prompt the user with this: Please enter the password: Then I want the script ...
-2
votes
1answer
50 views

Output a colon delimited file to another file [closed]

I have the following example file: root:server1:2014-12-12:x:Open:adm bin daemon lp mail other root sys users sectmp:server1:2014-12-12:x:Open:users smbnull:server1:2014-12-12:x:Locked:ids ...
0
votes
1answer
60 views

Interactive shell in background inside another shell script

I have some problems when trying to run an interactive sh session inside a shell script. The inner sh process uses all the CPU and never terminates. To reproduce the issue simply create a file named ...
1
vote
1answer
36 views

Shutter Script(s)

When i play some games with wine , i must not change the window , because of that , the game crash or that window are fill of black. im using xfce4 desktop , when i press "PrintScreen" key from ...
11
votes
3answers
767 views

How do you continue a sentence with a command inside

For example, I have been trying to say "There are 10 people online at the moment" in my script file. I can never seem to get the command working without the "people online at the moment" part on the ...
1
vote
2answers
70 views

ifconfig -a get needed data grepping

If I issue following command to obtain network interface data: [root@pi lib]# ifconfig -a eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.154 netmask ...
9
votes
8answers
217 views

Find duplicate PDF files by content

Some journals generate a different PDF for each download. APS for example stores time and the IP address in the PDF. Or there is a paper version with hyper links and one with text references. How ...
0
votes
2answers
124 views

Run two scripts at the same time

I want to run two scripts at the same time. How exactly do I do this? If I have a variable called foo in script1 and change its value to 5, and if I'm using a variable with the same name in script2 ...
1
vote
0answers
58 views

Logrotate or scripting to manipulate log file

I want to make sure that a certain log file gets empty when it reaches a specific size. I first used logrotate since the man page says: It will not modify a log multiple times in one day unless ...
-1
votes
2answers
140 views

Check if a file is a text file in bash

I am trying to make a check to see if the file being attached to the email is a text file, and if it is not it returns an error. However during testing, I provide a valid text.txt and it returns the ...
0
votes
1answer
57 views

Script thinks input is a command?

I'm just getting started on a script that does basic shell commands, but the second function, which is supposed to take a valid year and month and plug them into cal, is returning with this error: ...
1
vote
5answers
135 views

How to get the unique count of a particular part of a string

I have a set of data in a file. psf7433-nlhrms unit7433-nobody unit7333-opera bpx7333-operations app7333-osm unit7330-partners psf7331-pdesmond unit7333-projm mnp7330-redirect unit7333-retailbanking ...
2
votes
3answers
103 views

How can I print only variables defined inside my shell script?

Lets supose some bash shell script like: #!/bin/bash a=3 b=7 set -o posix set In this case, the execution of the set variable or some other of the commands to print environment variables ...
1
vote
2answers
58 views

untar shell script

i have a directory in which there are multiple tar files like tweets10_1.tar tweets10_2.tar tweets10_8.tar now i want to untar these files and keep them in a directory structure like 10_1 10_2 ...