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)

2
votes
1answer
52 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
51 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
65 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
44 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
112 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
32 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
28 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
88 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
33 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
46 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 ...
-2
votes
2answers
34 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
173 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
68 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
173 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
27 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 ...
1
vote
2answers
38 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
36 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
56 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
35 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
45 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
1answer
69 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
26 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
42 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
108 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
31 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
79 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
57 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
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 ...
2
votes
2answers
46 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
125 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
265 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
57 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
29 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
49 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
59 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
160 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
50 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
88 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
115 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
20 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
58 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
48 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
211 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
13 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
386 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
80 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
93 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
54 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 ...