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)

0
votes
1answer
9 views

How can I pass a function name to a test runner?

I wanted to write my own test runner: do_test () { function_under_test=$1 expected="$2" function_under_test $3 # <-- Line 32 if [ $result -eq $expected ]; then printf '.' else ...
0
votes
2answers
30 views

Why do I get Illegal number: {1..3}

Why am I getting ./6_sum_square_difference.sh: 11: ./6_sum_square_difference.sh: Illegal number: {1..3} for #!/bin/sh summing () { the_total=0 num_in=$1 for one_num in {1..$num_in} do ...
2
votes
0answers
17 views

Easy command line method to determine specific ARM architecture string?

I'm trying to write a script which will determine actions based on the architecture of the machine. I already use uname -m to gather the architecture line, however I do not know how many ARM ...
0
votes
1answer
41 views

Why does this comparison return not equal?

Can't seem to get this to evaluate to true is_equal () { in="$1" if [[ "$in" == "385" ]]; then return 0 else return 1 fi } a= is_equal 385 if [[ "$a" ]]; then echo "equal" else ...
0
votes
0answers
36 views

Increment Numbers in URL?

I want to create a list of URLs. The URLs have two sets of identical numbers which need to be incremented by 1: http://sample.com/poilus/cwrgshs/192/192.html ...
-1
votes
1answer
21 views

Check exist file on another pc

Yesterday I had ask how to use my tftp protocol in my bash script: Debian - Using TFTP in a bash script And now I have a problem with my tftp protocol. The file who was taken depend of my Hostname. ...
0
votes
1answer
23 views

Debian - Using TFTP in a bash script

I'm actually using RPiTC (Raspberry Pi Thin Client). I had create a script to see if my Hostname has the same name than a file. And now I want to say "If my Hostname don't have the same name than my ...
0
votes
2answers
28 views

Multiply a column using awk

How do I multiply a column by an integer (say 3) and replace the older value by new one, using awk? Input: Data 9390.900391 10573.089844 80.000000 200.000000 2.700000 Data ...
-2
votes
2answers
24 views

How to use shift to shift $@ one over

I am running a shells script with 3 arguments. I am getting the word count of each one. But I want to skip over the very first argument, maybe by using shift or something else. Most of the examples ...
1
vote
1answer
17 views

Compare two Arrays in KSH and output the difference

I am not extremely familiar with KSH (Actually just started using it) and I am having problems with trying to create a script that will essentially compare two arrays that have been stored and then ...
0
votes
1answer
30 views

How to make $@ start one iteration ahead

I'm running a bash script and am reading file contents of each one, but I want to skip the first one. I know of the "shift" command, but I'm having trouble getting it to go one over. I currently have ...
1
vote
3answers
40 views

How to access the contents of a file that is used as an argument when running a bash script?

I am running a bash script with its parameters/arguments as files. From inside the script, how do I get the contents of those files? I run the script with this command line: sh script_name ...
-5
votes
0answers
39 views

Match key from File1 and File2 and send output to File 3 in either case and to File 4 in No match case in a specific format [closed]

File 1: 01 08 2014-12-08 04 5000 01 01 90488305 00000 001 2014-12-04 01:21:28 2014-12-08 04 001 04 ...
-2
votes
2answers
25 views

extracting only the domainname, port number of first path

str1="https://111.111.111.111:2222/cpsess8993738132/scripts4/listaccts/" str2="https://111.111.111.111:2222/cpsess8993738132/" ...
0
votes
2answers
43 views

Running a program (command) on terminal after login screen in Ubuntu 14.04

NOTE :- This is not a duplicate question. I have searched about 100 times on this site and several others including Ubuntuforums,askubuntu and stackoverflow. I couldn't get my work done. OBJECTIVE :- ...
1
vote
1answer
38 views

Using cURL, How can I fetch a numerical string which contains commas and spaces and convert such to a NON COMAFIED string [duplicate]

Example: Google's Outstanding Shares are 670,000,000 and this value is collected in a txt file from Yahoo Finance API using the below script. The issue is; that numbers WITH commas or spaces are ...
-4
votes
1answer
56 views

Merge two csvfiles by column header

I have two csv files: success.csv "ID","Legacy ID","Field1", "Field2" 1,1111,google,news 2,2222,yahoo,news error.csv "Legacy ID","Field1","Field2","Message" 3333,aol,news,"Failed to upload ...
0
votes
2answers
26 views

I'd like my script to interpret links when processing files

> ls -l aliasedname lrwxr-xr-x 1 anon3202 users 19 Dec 25 05:24 aliasedname -> www/realfilename I'd like for my script to return details about ~/www/realfilename when it's fed information ...
-2
votes
0answers
27 views

how to get out of PID and port of Solaris 9

Server and the port list are taken from a file "demo", I need the port's process ID to run the ps command. #!/bin/bash while read -r -u10 server port line do echo ========== server: "$server" port: ...
1
vote
2answers
31 views

Help with Script to Process txt file to CSV

I am trying/attempting to write a script to turn this: Mikrotik01#show unique routing entry | 192.168.255.232 | inc ID Thu June 10 15:21:32.808 CST Unique Entry: 192.168.255.21 Unique Entry: ...
0
votes
1answer
32 views

unable to read the output to run the next command [closed]

When this script is executed I get the PID. Now I want to read the output "PID" and run the next command in this way: ps -ef | grep -i PID ps -ef | grep -i PID while read -r -u10 server port ...
2
votes
0answers
45 views

“Restart” a process in the same terminal?

I put "restart" in quotes because the following question on SO illustrates what I'm trying to do: http://stackoverflow.com/questions/27957091/restarting-a-process-in-the-same-linux-terminal I'm ...
1
vote
1answer
31 views

remove a portion of a line contained within two different types of separator / delimiters [duplicate]

Most of the commandline tools I'm looking at have the ability to pick a field delimiter. However, I'd like to pick one delimiter to start, and a different one to end the segment of text I'd like to ...
3
votes
0answers
28 views

How do I schedule a cron task to run

I'm looking to crontab a script every hour starting Friday at 5pm... ending Monday at 5am. This script checks if it's completed this week and if it's currently running. If no/no, start task. Off the ...
1
vote
0answers
46 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
18 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
37 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
88 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
29 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
63 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
49 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, ...
-2
votes
0answers
24 views

Extracting soft clipped sequences

I have a file like this SRR959756.2011 256 20S24M GCCGGGCGCAGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG SRR959756.2011 256 19S22M3S GCCGGGCGCAGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG SRR959756.2011 256 ...
0
votes
0answers
16 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 ...
-1
votes
0answers
24 views

How to run a script when install a rpm package and answer the installation questions

I will like to know how to install the RPM and answer the installation question automatically if is possible. any ideas.
2
votes
2answers
41 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
120 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
1answer
69 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
35 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
27 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
42 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
37 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
118 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
19 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
35 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
39 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
64 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
13 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
34 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
45 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
134 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 ...