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

Execute Perl commands from a specific IP?

I have a Debian Jessie 8 server with three unique IPv4 IPs. I connect to the server from Windows 7 via Putty. I can open three Putty windows using each of the three IPs. I am trying to execute a Perl ...
0
votes
1answer
28 views

Creating a Wireless Network Management GUI workaround

I just installed Alpine linux, and it all went as smoothly as i'd hoped, except for the wireless networking (and XFCE's Power button and reboot buttons being greyed out, but that's irrelevant here). ...
2
votes
1answer
30 views

Using individual lines from grep outputs

I'm trying to grab lines from grep and sorting them into another command, the command I'm using for grepping atm is as follows (hasn't yet been chopped enough for what I will be using it, but this ...
1
vote
4answers
48 views

making an array of all subdirectories via the output of a command

My idea is to make a script which gives all subdirectories (in my case ˜/MUSIC but on the mac of my wife is it different –> artist/album). In a later fase I would like convert all .wav extensions to ...
2
votes
2answers
786 views

securely automating a script which requires a key to do its task

I have a script that downloads bank transactions to store in a database. To get these transactions requires a password for each account. The database is encrypted and requires a key to access it. All ...
0
votes
1answer
34 views

Print concat vars inside loop

I have a code like this: cat input | while read p; do lynx -dump "www.xyz.com/p?=$p" | grep -m 1 -A 1 "Hello" | awk -F: '{print $2}' >> output done Where the content looks like this: [$p ...
0
votes
1answer
15 views

Getting cron to include Date IN error log

So I have the following Cron job running: /home/ubuntu/scripts/austria/archive.sh >> /home/ubuntu/logs/austria/archive.log 2>> /home/ubuntu/logs/austria/archive.err Every time the scrip runs, it ...
-1
votes
1answer
46 views

How to edit a file from a script using a loop instead of find and replace with sed? [duplicate]

Here is the sample of the code of what my intent is for such a script: #!/bin/bash Update=$1 if [$Update == Value] then NewValue= $Update vi %s/Value/$NewValue/g > Updatedfile fi ...
4
votes
4answers
338 views

$@ except the 1st argument

I need to write a shell script that runs in this way: ./myscript arg1 arg2_1 arg2_2 arg2_3 ....... arg2_# there is a for loop inside script for i in $@ However, as I know, $@ includes $1 up to ...
-3
votes
1answer
42 views

How can i replace a specific string within a line inside a text file [duplicate]

$ cat text.txt my name is Steven my age is 10 i like dogs What command will be fitting so that echo "Kate" will replace Steven on text.txt?
0
votes
0answers
15 views

Continuous files are coming into predefined folder

I want a script to check continuous files are coming into predefined folder ,if file haven't received in last 15 min then it would shoot an alert mail.
2
votes
6answers
5k views

Bash eval array variable name

Here is my bash case: First case, this is what I want to do "aliasing" var with myvarA: myvarA="variableA" varname="A" eval varAlias=\$"myvar"$varname echo $varAlias Second case for array variable ...
0
votes
5answers
68 views

Appending One File to the Second Until End of File

I have two files. The first is just a single number. This number is calculated and changes every time. The second file has a bunch of columns, and I do not know the number of rows (which can change). ...
4
votes
3answers
572 views

Loop ignores change of variable from a subshell in the background

I wrote a script that contains an until loop. This loop should run till a boolean variable is set to true from outside the loop. Unfortunately the loop ignores that the variable has been set to true ...
0
votes
1answer
24 views

Output date is not proper when the script is ran using cron

The below line should provide an output date which when ran manually gives an proper output like Fri Jul 17 01:42:07 2015. But when ran using cron gives the epoch date i.e. Wed Dec 31 19:00:00 1969 ...
0
votes
1answer
22 views

Perl one-liner to replace a code block

I have a file foo.txt hello world first line to change second line to change I would like to write a perl one-liner that changes foo.txt to read hello world this is my ...
25
votes
12answers
9k views

Object-oriented shell for *nix

Preface: I love bash and have no intention of starting any sort of argument or holy-war, and hopefully this is not an extremely naive question. This question is somewhat related to this post on ...
0
votes
1answer
20 views

Running repetitive task through Bash script

I'm running a few repetitive tasks and I think will be good to create a small bash script to perform all them in just one command: run the bash script. This are the tasks I need to run: # stop HTTPD, ...
1
vote
3answers
1k views

How to set Ruby GEM_HOME and GEM_PATH

I'm a NOVICE user of Linux and using Linux mint 17.1 I've reinstalled Linux mint 20 time in last 3 days for that issue but could not fix it I'm trying to install ruby on rails using rvm what ...
2
votes
2answers
5k views

grep output of expect script

I'm trying to run some expect language, and grep/parse the output all in one script. I want to grep the output of and look for "error" (I should note that standard linux commands like awk, sed, grep, ...
1
vote
0answers
101 views

Perl Script to Display Pork Offline Message

I use pork 0.99.8.1 on openSuse 11.4 for my AIM account when I don't want to use irssi + bitlbee. The only problem I have encountered so far is that offline messages are not displayed. I just get a ...
1
vote
2answers
20 views

Script that only counts Established, TIME_WAIT, and Closed Wait connections using Netstat

I'm trying to make a script (using Perl, but it isn't necessary) that will only count the number of Established, Time_Wait, and Closed_Wait connections on a system and print them in terminal. So far ...
-4
votes
2answers
44 views

Web Server Log Analyse

I have a web server log file I have to create a command-line pipeline to display the top ten most visited pages. I then have to embed it in a shell script. I'm completely new to Linux coding so how ...
4
votes
2answers
68 views

How to shutdown a list of servers, making sure the first one is off before shutting down the next?

I have a list of 17 servers in this format: 172.16.6.45 i-052463fs (test-mv1) 172.16.6.46 i-9e2263rf (test-mv2) I'd like a script that can ssh/login to each and every of these servers and ...
-3
votes
0answers
13 views

Script Answer SHELL or PERL [duplicate]

Please explain the script which starts as: SCRPT_NM="${0##/}"; SCRPT_BASE_NM="${SCRPT_NM%.}"; SCRPT_NM=$0 and also whats the difference between the SCRPT_NM=$0 and SCRPT_NM="${0##*/}";
0
votes
1answer
41 views

Shell script for logrotating

I want to create a shell script for logrotating. following are my requirement. want to archive the log files to a particular directory lets(/usr/local/jboss-5.10..GA/server/archive/log) older than ...
3
votes
3answers
585 views

how to execute a bash command in a python script

How can I launch a bash command with multiple args (for example "sudo apt update") from a python script?
1
vote
2answers
30 views

shell script for chmod file name but only on new files since last run of the script

i have a directory where new files are uploaded and receive numeric filename as they are uploaded. the file name is numbers that go up. i need to change permissions for the file but only on new files ...
0
votes
2answers
808 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 ...
8
votes
4answers
5k views

End sox recording once silence is detected

I'm writing a script that uses sox to record me talking. Now I need sox to wait until it detects sound before it begins recording, and I do have that figured out. But I also need sox to exit once ...
0
votes
1answer
2k views

How to execute grep in tcl for getting XYZ-123 type pattern

How can I execute this grep command in TCL? grep '[A-Z][A-Z][A-Z]\-[0-9][0-9][0-9]' file1 > file2
1
vote
2answers
52 views

clickable (gui) Bash script?

Was just finishing some script containing a choice menu and was wondering if there's a tool out there that could be called by a script, provides a 1-click-choice-menu and returns the result back to ...
1
vote
3answers
55 views

Merge several files on the basis of the md5sum

I have a file data.txt, which was divided into fragments. I need to properly combine fragments of files so that the original file was created data.txt. I do not know what kolejoności do this, because ...
10
votes
1answer
9k views

How to automatically record all your terminal sessions with script utility

What I want to achieve is be able to record my terminal sessions to file automatically whenever I use Yakuake/Konsole. It's easy to achieve if at the start of my session I do: script -f ...
0
votes
1answer
2k views

How to execute Netscaler commands through a remote machine via SSH connection

I have been trying to execute some NetScaler commands like "bind" & "unbind" through a Linux Box via an SSH Connection. Now the Problem is, Manually we are able to enter & execute commands on ...
12
votes
2answers
593 views

Ask for a password in POSIX-compliant shell?

When I want to ask for a password in a bash script, I do that : read -s ...but when I run bash in POSIX mode, with sh, the option don't exists : $ read -s sh: 1: read: Illegal option -s How do I ...
3
votes
4answers
337 views

Is there a difference between ./script and bash script? [duplicate]

Given a shell script file that begins as #!/bin/bash # (bash script here), and has been chmod +xed, is there any difference in running ./script and bash script from the command-line?
-1
votes
2answers
66 views

How do I take a prompt response and send it to a text file?

I'm new to shell scripting and I need help I want to ask the user what is their ORACLE_SID, ORACLE_HOME, and then send the output in a file. I want to create a param file that has ORACLE_HOME= ...
6
votes
1answer
714 views

Can capabilities be used in scripts without setcap'ing the interpreter binary?

Right now I'm using cap_net_bind_service MY_USERNAME in /etc/security/capability.conf. Now I just need to set cap_net_bind_service+i on the interpreter of my favouite scripting language to be able to ...
3
votes
3answers
6k views

How to grep for same string but multiple files at the same time?

I have a set of log files that I need to review and I would like to search specific strings on the same files at once Is this possible? Currently I am using grep -E ...
0
votes
3answers
869 views

Split XML file into multiple files

I have an xml file that have different nodes, I want to split files like this: <unix> <mm> </unix> <osx> <nn> </osx> When I run the script I want it to make ...
0
votes
1answer
39 views

How to get a X line from file1 and Y line from file2 using shell command?

In file 1, 'Server restoration is complete now. It will be operational within few seconds. Please keep all the log file once the restoration is complete.' In file 2, 'Restoration was successfully ...
0
votes
1answer
30 views

Formating VGA info to conky

I'm trying get conky working on my system, and I'm stuck on how to format an specific shell variable to display my VGA. From shell I get my VGA using: lspci | grep VGA The output: 01:00.0 VGA ...
0
votes
1answer
20 views

Bash exit from subcommand [duplicate]

I have a script with the following code: command_that_could_fail || (echo "command failed"; exit 1) However, the exit seems to just be exiting from the sub-command formed by the second part of the ...
0
votes
2answers
58 views

Bash script arguments not being passed to function? [closed]

I'm trying to pass the arguments when invoking a bash script to a function defined in that script. In my head this is trivial but in practice seems more difficult. Script is: #!/bin/bash function ...
1
vote
3answers
2k views

Configure localtime. dpkg-reconfigure tzdata

I'm using this to configure localtime: dpkg-reconfigure tzdata It is ncurses interface. I'm looking for the way to programming this. Is there true way without user ncurses interface? How to ...
1
vote
0answers
46 views

Systemd script not echoing

I've recently setup Fedora 22 onto a machine and it's using the systemd filesystem. I've been reading up on it and now I need to create a systemd start up script for postgresql For testing I created ...
2
votes
1answer
45 views

make sure all lines in a textfiles don't have the same value

I have a text file that contain multiple lines. Some of the lines have contain same value. What I want is to make sure that all of the lines do not have duplicates or "triplicates". Sample: ...
1
vote
2answers
51 views

How can I make flashing text in bash?

In the script bellow, how can I make the the word "end" from the output of the command " printf "\e[41mend==>\e[m $i "", flashing? #!/bin/bash in=path_to_my_folder for i in $(cat ${in}/file.txt); ...
4
votes
2answers
244 views

Converting and rescaling a lot of png images to jpeg

I have a lot of .png images in a folder. Is there a command (or software) that can convert all them to .jpg and (simultaneously) rescale the created .jpg files to 25% of their original size?