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

piping python variable value to bash script (inside python script)

After years of bash scripting I've been given the task of modifying a python script to have it call a shell script when certain conditions are met. That part wasn't too bad, but now I'm trying to ...
0
votes
2answers
32 views

Taking numbers from a text file and add them together

I have text file with hundreds of lines like below. I am trying to find a way to pull the number of records and add them together. Then I want to put the answer in a separate file This is my first ...
-5
votes
0answers
17 views

How can i write this script to fullfill my needs? [on hold]

In which I have a string ”mt school is over" If string is matches then i have to match binno-12245 If this matches then instno-4567 If this matches den i have to copy data from binno to next 11 line ...
1
vote
1answer
28 views

Make a command to remove NetworkManager connections

I’m working in a manufacturing company (small one) and one of our clients required a test using a Linux (Ubuntu) computer, we are testing some wi-fi modules. the test is simple. beforehand: Powering ...
2
votes
1answer
31 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 ...
0
votes
1answer
37 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). ...
0
votes
2answers
41 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
37 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
18 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 ...
-3
votes
1answer
44 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?
5
votes
4answers
348 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 ...
0
votes
0answers
16 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.
4
votes
3answers
575 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
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). ...
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 ...
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, ...
0
votes
1answer
26 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 ...
1
vote
2answers
24 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
45 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 ...
-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##*/}";
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 ...
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 ...
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 ...
1
vote
2answers
54 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 ...
12
votes
2answers
598 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 ...
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
23 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
60 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
2answers
53 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); ...
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 ...
-1
votes
2answers
68 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= ...
0
votes
1answer
34 views

Systemd postgresql start script

I'm in the process of installing postgresql onto a second server Previously I installed postgresql and then used the supplied script ./contrib/start-scripts/linux Placed into the correct dir # cp ...
4
votes
1answer
48 views

Where to save temporary files for shell scripts

I have a script to toggle my screen backlight (mapped to a keyboard shortcut), and I want to save the brightness level so I can restore it when pressing the keyboard shortcut again. Is there a ...
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: ...
2
votes
5answers
563 views

How to add a password to a BASH script

I want to create a script to run the following BASH command: mysqldump -u [username] -p [db_name] > [path to backup file] Which results in a backup file. When running this in BASH, it prompts ...
0
votes
0answers
26 views

Start a process from (noninteractive) shell script (cgi) and keep it running when script ends

I want a cgi script to start a process which stays alive after the cgi script exits. I tried: #!/bin/bash nohup process-to-keep-running & That works fine, if I run the script from an ...
1
vote
2answers
37 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
0answers
19 views

IPC or command line? [migrated]

I'm creating a nodejs program that need to use some unix command. I have two choices either execute them using exec('command ...') which just execute the command with the given arguments. Or through ...
1
vote
1answer
25 views

LXDE hotkey to start app or switch to it if already running

I got used to Win+(1..9) hotkeys in windows 7+, and would like to implement something like this in LXDE. So, I need to define a hotkey that will: launch defined application if it is not launched ...
4
votes
2answers
71 views

Stop writing to a capture file after it reaches a specific size

I'd like to monitor my network traffic of an specific interface to file. Then I would like to stop the interface if the traffic counts over 60mb total. Is there a possible way to do that?
2
votes
0answers
19 views

How to dynamically control the audio volume based on current decibels

Since the Internet videos have different sound volume levels I am wondering is there a way to dynamically decrease the audio volume if it's above certain decibels to a normal value. Could someone ...
3
votes
1answer
39 views

How to programatically control X11 forwarded apps?

I'd like to set-up X11 Forwarding to run remote X applications on the server and X11 client can handle the UX interaction. However I would like to configure the X11 client or fake it to actual do the ...
0
votes
1answer
46 views

How to copy files to the timestamp generated directory?

Hello I am trying to copy all files from Documents directory to the backup directory that has a timestamp. So I have created a directory called bk$( the time stamp of the directory) and I am trying to ...
2
votes
1answer
39 views

Dynamic Variable in KornShell Script

This KornShell Script (ksh): envir=Dev eval "${envir}foo=bar" echo "$Devfoo" Output: bar But I will not know what value is assigned to envir variable. So I want to do something like this where ...
0
votes
0answers
98 views

Bash, find and delete old files

Write script for backup files and delete old: #!/bin/sh BACKUPDIR=/var/backups/files ROTATE=1 mkdir -p $BACKUPDIR CURRENT="$BACKUPDIR/`date +%Y-%m-%d`-files.tar.gz" cd /var/ && tar czf ...
1
vote
1answer
74 views

Can I execute a script before every login

I am planning to have a program that will need to connect to a server. I'd like to be able to send a encrypted password to my server. The thing is, I need my decrypting script to be executed ...
2
votes
1answer
78 views

How to create gcov files for a project in a different dir?

I want to analyze code coverage datas. I want to create gcov files from OpenSSL (and from other projects), but I can only create them in the same directory of the project, and only for the files in ...
2
votes
2answers
49 views

Delete Entries in File if the Same Entry Exists in a Master File

I have a JSON master config file whose value may be overwritten by a specific account's config file (also in JSON). The Master file has this structure: { "section1Configs": { "setting01": ...
-1
votes
2answers
48 views

Find file, Edit text within files

Im trying to find a file then edit the text within these files. This is what I have so far, but sadly Im not that well versed... Help Please? grep -rl "wrongtext" ~/Library/Calendars ...