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)

39
votes
5answers
47k views

Using while loop to ssh to multiple servers

I have a file servers.txt, with list of servers: server1.mydomain.com server2.mydomain.com server3.mydomain.com when I read the file line by line with while and echo each line, all works as ...
0
votes
2answers
65 views

Script for ssh automatic login to a specific port

So currently, the "traditional" way to connect through SSH is the following one: ssh USERNAME@HOST -p PORT I would like to create a script in which I will include all the appropriate information ...
1
vote
0answers
36 views

Bold and Underline using echo with email

I am using a script that emails me a particular status report. The script sends me the contents of several files. I am using echo to provide a heading in the email that is used to differentiate ...
0
votes
0answers
10 views

LUA Script syntax

I wrote under suggestion a LUA script clearDS() addDS(".", "IN DNSKEY 257 3 8 ...
1
vote
0answers
51 views

File exists but errors with “mv: cannot stat: No such file or directory”

For some reason my script cannot copy or move files that exist. It comes up with the errors below. Can someone tell me why? cp: cannot stat '/mnt/sd/bbu/install/scratch/bin/.': No such file or ...
2
votes
1answer
43 views

Possible race condition when scripting headphone plug-in event

I'm currently trying to script the headphone plug-in/out event. I found out that I can script this quite easily as an acpi event.. I created a file in /etc/acpi/events/ with the event event=jack[ ...
0
votes
0answers
17 views

script for user login/logoff timings everyday and delete the files which are older then 5 days

The below code is not running.  Can anyone please let me know the mistake? do-every-day.sh #create file & cpy the below contents lastlog -b 0 -t 1 > files.txt find files.txt -mtime ...
18
votes
6answers
1k views

How can I suppress output only if the command succeeds?

I would like to simplify the output of a script by suppressing the output of secondary commands that are usually successful. However, using -q on them hides the output when they occasionally fail, so ...
1
vote
0answers
35 views

Setting environment variable using shell script

I am using csh scripts for some automation purpose. I have a number of scripts, and the beginning of all of which I need to set a fixed set of environment variables. |----SCRIPT 1---| |----SCRIPT ...
1
vote
2answers
710 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 ...
0
votes
0answers
39 views

Cronjob python script

I have a python script that parses some html and then writes it to output file. I want that cronjob would execute that python script. When I run this script from command line it works fine (python ...
16
votes
10answers
52k views

Automatically run commands over SSH on many servers

There is a list of IP addresses in a .txt file, ex.: 1.1.1.1 2.2.2.2 3.3.3.3 Behind every IP address there is a server, and on every server there is an sshd running on port 22. Not every server is ...
0
votes
1answer
24 views

Sort words from n rows

i need to print all the unique words and their occurences from first n rows in a give file. I have to sorted by their number of occurences and then alphabetically.(the only separator is " ") ex: for ...
14
votes
5answers
21k views

Automated ssh-keygen without passphrase, how?

I would like to make an automated script that calls ssh-keygen and creates some pub/private keypairs that I will use later on. In principle everything works fine with.... ssh-keygen -b 2048 -t rsa -f ...
0
votes
2answers
41 views

Sort words in file

i've got some problems i'm not capable to overcome. I need to count the first let's say N words in a txt file. Then , i have to print them in decresing order, followed by the number of occurences.The ...
1
vote
2answers
29 views

How do I find a substring in a command line?

I have a few files that contains a similar entry like as follows: {"result":[]} {"result":[{"alternative":[{"transcript":"I ...
2
votes
0answers
38 views

Full screen terminal with script as screen saver under archLinux

Bonjour, Is it possible to run a terminal at full screen running a script instead of the screen saver ? That means that after 10 minutes of inactivity the screen should go black and show the STDOUT of ...
-1
votes
1answer
49 views

How to change shell from script

I want to change shell from ksh to bash and source the .kshrc file. I want to execute following lines of command sequentially: bash . ~/.kshrc clear Can anybody help me?
0
votes
3answers
2k 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
15 views

Getting error while using httpd -v command in script

I wrote a script to check the details of Web server's(RHEL) and save the output into a file. But the script is not passing the command httpd -v in the loop. Here is the script. #!/bin/bash for i in ...
1
vote
5answers
771 views

Rerunning the same command with a different parameter

I know that I can run the following command ls Some{File,Folder} And it is equivalent to running this: ls SomeFile SomeFolder (I also use it a lot for things like mv place_{a,b}) However, I was ...
0
votes
1answer
28 views

get `top` output for non interactive shell

I want to implement top function for the web app, is it possible to get the output of top command in non interactive shell.
0
votes
0answers
20 views

Pantheon-Terminal open multiple tabs script

I'm new to linux so bear with me. I'm looking for a script that will open pantheon-terminal with 3 tabs, each with a certain location / commands. I have a basic script that when I run from the ...
1
vote
1answer
27 views

LFTP Script to Download Files

I want to write a lftp script that will download files every 15 minutes from a server every x amount of time. Can someone advise how i can do this? Thanks
11
votes
4answers
13k views

Invert boolean variable

I want to try simple script flag=false while !$flag do read x if [ "$x" -eq "true" ] then flag=true fi echo "${x} : ${flag}" done But when I run it, if I type true, I will see ...
1
vote
2answers
39 views

How can I run this python script on all html files under a directory? [duplicate]

I have a python script $ cat ~/script.py import sys from lxml import etree from lxml.html import parse doc = parse(sys.argv[1]) title = doc.find('//title') title.text = span2.text.strip() print ...
6
votes
3answers
12k views

Case-insensitive substring search in a shell script [closed]

How can I write bash code that will do a case-insensitive substring match of command output?
8
votes
7answers
9k views

Extracting nested zip files

I have numerous zip archives, each of which contains a number of zip archives. What is the best way to recursively extract all files contained within this zip archive and its child zip archives, that ...
0
votes
1answer
23 views

regarding recursive deleting of a specific file type

I wanted to delete a specific file type say *.bak file from any directory and its subdirectories. I used the following command to find the files. find <path> -name "*.bak" -type f However, ...
0
votes
1answer
22 views

Finding files that have been modified using a script?

I need to find files in a given directory that have been modified in the last N days, where N is the second argument of the script. Basically, I need to give the command with 2 numbers (arguments) and ...
1
vote
2answers
162 views

ffmpeg script - slicing a video into multiple slices

I am currently using ffmpeg to slice video files. I automated the process through a script called ffmpeg_split.sh. To view the script click here. When I run the script I have an error when trying to ...
1
vote
2answers
37 views

Script to Organize Desktop into Folders/Directories by Extension

I'd like to organize desktops by running a script that places all of your files into folders by extension. I found some code through googling and the code I found creates a folder with the name of the ...
2
votes
1answer
46 views

Regular Expression to match (not x) and y (!x & y)

I received a desktop day-to-day calendar with puzzles. One such puzzle was deciphering a quote where the letters were substituted with symbols. I used some RegExs to find longer words, then used the ...
-4
votes
1answer
34 views

find problems again? [closed]

How do i show pipe or socked files from a directory? echo "give name of directory: " read directory if [ -d "$directory" ] then echo "thanks again" else exit fi find $directory -maxdepth 1 -type ...
0
votes
0answers
26 views

Creating a mini text-editing program

I often copy-paste text from pdfs into other applications, and wish there was an easy offline way of editing the text's characteristics. For example, this website removes line breaks, while this ...
-2
votes
2answers
79 views

How do you remove newline character in the middle of file?

File structure: Col1|Col2|Col3|Col4 123|456|abcdefg Tel.: 689346589934, xyz lckhasfkl|abc I want to remove the newline character from 'col3' only.Please suggest
0
votes
2answers
1k 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 ...
9
votes
4answers
4k views

How to constraint time a program runs in Linux?

I have several simulations to do, each is invoked with python simulate.py <parameter list>. The problem with these simulations is that some of them hang without quiting, which prevents me from ...
0
votes
1answer
51 views

Runlevel script

I want to make a simple script so that the user can easy change the runlevels. The script should prompt the user to choose the new runlevel, run the /sbin/init program and receive a confirmation ...
3
votes
2answers
6k 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, ...
4
votes
2answers
128 views

How do I sync files between two drives?

What command can check that a directory contains the same files as another directory, all the files are up to date and copy any updated files or new files to the first directory. It should not care ...
0
votes
2answers
42 views

how to write python code to change display color

I want to change display color. I have a simple script: #!/bin/bash sleep 50 xrandr --output VGA1 --gamma 1.28:1:1.28 # for purple How can I write it in python?
1
vote
1answer
22 views

mpack description (-d) from a script variable

In my script I have a variable named $message. I want to send this message together with a jpeg using mpack. One way that works: echo "$message" > myText mpack -s "test mail" -d myText ...
2
votes
1answer
38 views

Run executable with variable in Bash

I have the following simple script to run an executable: ./executable.x -input input.dat << i input1 input2 i This works perfectly and all is right with the world. However, I would like to ...
3
votes
1answer
34 views

Allow only wrapper script but not command

Say one has a resource hungry command that users on a server need to run. I want to wrap said command with a wrapper script that will parse the arguments passed and ensure that the command is only ...
11
votes
2answers
12k 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 ...
1
vote
2answers
39 views

Storing application passwords in central location

Is there any secure local service that one should use for storing and retrieving organization wide application passwords? Most of the time we need authentication information in our scripts to run some ...
-1
votes
1answer
39 views

awk getline to display first three lines in file

I'm using awk 'BEGIN {while((getline gf < "awk.script") > 0) {print gf}}' to read me first 3 three lines of the pattern. I can do with head -3 . But I don't want to since, I have to switch ...
0
votes
1answer
40 views

Measuring how much batteries lasts on another system? [closed]

I have both a Linux computer and Microsoft Vista laptop. I would like to know how much the batteries last on the laptop from the computer. How can I do a script for that, i.e. how to check on Linux ...
0
votes
1answer
22 views

tftp non-intearctive mode not working

tftp inline not working root@kali:~/scripts/recon_enum/exploit-db# tftp -v 192.xxx.xx.xxx 69 -c get text.txt text.txt usage: tftp host-name [port] tftp> but its working in interactive mode: ...