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)

2
votes
1answer
21 views

tmux Bash Script

How can I write the following in a bash script? tmux # Start tmux session. compass watch /path/to/project1/compass/ # Run the first process. Ctrl + B, " # Split the pane. compass watch /path/to/...
0
votes
3answers
2k 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 "#transcode{vcodec=h264,vb=999,acodec=mp3,ab=128,...
0
votes
2answers
55 views

How to add users from data in a text file

I am a beginner in linux. I have a question about creating multiple users in linux, but I need a program to work on it. There is a new users txt file, the content is following: adams:5000:Adams, John ...
0
votes
0answers
39 views

Bash script: read file for strings and output those lines to new .txt file, what's the best route?

I have a spreadsheet(.xlsx) that I need to scan for 5 strings from only 1 column, then I need to output those rows to a new text file. It has to be a bash script, i.e. no perl/python/ruby, and from ...
0
votes
0answers
29 views

How to forward every packets to another IP? [on hold]

I am doing an experiment for my master thesis. I want to run a function (e.g. multiply two 10-digit) when a specific packet is received (e.g. a packet with destination TCP port 6666). How can I do it? ...
1
vote
1answer
3k 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 ...
0
votes
2answers
27 views

Passing variables to script [duplicate]

What is the difference between: ./script.sh "$VARIABLE" and ./script.sh ${VARIABLE} Is there any?
0
votes
4answers
1k views

Permission denied when run script via ssh

I wrote script which download via scp and install some packages. SSH keys are added to host and when I run [root@HostB ~]# ./myscript everything is ok and packages are downloaded via scp without ...
-1
votes
0answers
39 views

Need scrpit to run progam with variable files [on hold]

Need a script to automate this Move file mv /somedir/(whatever).apk /data/local/tmp/somedir Change Permissions if not change them /data/local/tmp/somedir = rwxrwxr-x /data/local/tmp/somedir/(...
18
votes
4answers
55k views

Confusing use of && and || operators

I was skimming through an /etc/rc.d/init.d/sendmail file (I know this is hardly ever used, but I'm studying for an exam), and I've become a bit confused about the && and the || operators. I'...
3
votes
2answers
57 views

Can you tell if a file has been renamed?

Many tools out there for syncing files aren't quite right for syncing you're home directory. Because of this, and to learn Ruby, I've been working on my own sync tool. An issue I've encountered, ...
-8
votes
1answer
40 views

HOow to run hello world using bash? [closed]

Tell me how to run bash.i am new in this area please help me
0
votes
1answer
3k 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
0
votes
2answers
37 views

cat doesn't join my files when I run inside script

I'm doing a restore backups script, and when I try to join files which are splitted, cat prints that error: cat: fullbackup_mrbsNuevo_15_6_2016.tar.gz.*: No such file or directory The line that ...
1
vote
1answer
46 views

How to compress all files in folder and erase the untared versions via command line?

I have a backup disk containing uncompressed versions of my files that I would like to compress to save space on this disk. The disk (containing files to compress) is full (about 3TB with 17GB free). ...
0
votes
1answer
134 views

Echo semicolon in bash

I am trying to write to a file the following string: 1;2;3;4. The semicolons create problems. I have been able to figure out the following ecamotage to do it: variable='1;2;3;4' echo "${variable//;/\...
1
vote
1answer
210 views

Why is my loop not continuing properly in my rock paper scissors game?

I'm making a bo3 rock paper scissors game. So far I've gotten it to work under every condition except ties. When a tie happens, it's meant to 'remake' that game by just subtracting 1 from I. It doesn'...
0
votes
0answers
25 views

Why is this udev remove rule not working? [duplicate]

Hate to ask this sort of question, but... Device info: udevadm monitor --env UDEV [3048.530438] remove /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.3 (usb) ACTION=remove BUSNUM=002 ...
0
votes
1answer
98 views

What's wrong with my elif statements in this rock paper scissors game I'm making [closed]

making a rock paper scissors game to learn better bash. For some reason it's not liking my elif statements and I can't figure out why. Also if there are any better ways of doing this let me know, ...
0
votes
1answer
50 views

how to replace special characters in large text file in shell scripting [closed]

I have using for below command but I have replaced special characters some characters is replaced some one not replaced that is my equation. sed "s/\,/\&\#44\;/g" VENKAT.TXT|sed "s/Décor/D\&...
2
votes
3answers
41 views

rename(1)-like script in Perl, but for copying files?

So there's this rename(1) Perl thing. It suits my task precisely, except that I need it to basically cp files instead of mv. How to achieve that? I have quite a few rules of renaming, all expressed ...
1
vote
2answers
63 views

Wait until a process comes back from sleep

script.sh is run by run.sh N times in parallel. For N=1, the script.sh process is set to sleep 30-45 seconds before it actually starts. How can I order ALL script.sh instances for N>1 not to start ...
1
vote
2answers
63 views

Copy files that are created today without FIND command and SFTP to another server

I have a directory with 'n' number of files in it. I am trying to write a shell script which will list only the files created on the particular day the script is running, and will use sftp to move the ...
1
vote
2answers
6k views

how do I run a cron job with a specific user?

My cron and scripting skills are very poor, but I need to run a job every 5 minutes by user 'cpc'. So I created a script and left it at /root. My crontab -e entry about it is: 0-59/5 * * * * /root/...
2
votes
1answer
85 views

Use xvfb to automate X program

I originally posted this question here, but upon second thoughts I decided here was a better place for this. I sadly have to use this proprietary program that bundles a camera driver. I want to ...
-1
votes
1answer
29 views

How to record numbers of array elements based on selection comparision criteria

I have many files which has many 2x2 arrays. In the present example I show only one file (file1) Input file(file1): 1: 6.1703 541.631 46.0391 2: 6.1930 537.446 45.9239 3: 6.1931 177.171 288.579 ...
0
votes
0answers
22 views

Execute custom script when wireless NIC connects to SSID

I have pieced together two scripts that will serve to execute a custom script when my wireless NIC connects to an SSID. Firstly, I will add the following (notice the post-up section): auto eth0 ...
0
votes
1answer
37 views

find: missing argument to '-exec'

this is my first post, as I am completely new to the programming world. Basically I'm taking a UNIX class and I have an assignment asking me to check the size of regular files in my home directory for ...
-2
votes
1answer
26 views

Unix shell scripting select and case statement

1) i want to write unix script which is like this echo "Do u want to check application logs ???" select opt in Yes No do case $opt in "Yes") commmands ;; "No") break ...
1
vote
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 ...
-2
votes
1answer
42 views

Write shell script for logging in servers and run command after logging in

I have wrote a shell script for logging into servers and run few commands to start and stop processes running on it, So I tried below code, but it is showing error, please help me with the script. ...
1
vote
1answer
59 views

Can a Linux server that authenticates against an Active Directory accept public/private keys for passwordless login?

I have a Linux server that authenticates users against an Active Directory. Now interactive logins require username and password and automatic login requires a keytab (Kerberos) for passwordless ...
0
votes
0answers
35 views

wgetting links that are written in script form - not plain html

I use wget to download all the html pages in an online gallery - in order to grab all the links to the full size images as follows: wget --wait=3 --user-agent=Webtography --no-cookies --timestamping -...
1
vote
1answer
34 views

Convert GPS coordinates with bash script

I need to convert to a specific format some gps coordinates which are the output of the exif information of a picture. This is the typical output: exif:GPSLatitude: 10/1, 10/1, 10/1 exif:...
-1
votes
0answers
39 views

File edition after glob function through python

I wanted to find every instances of a file under different directories and search for value 0 in each of those files and replace them with 500. Please find the code below #!/usr/bin/python import ...
0
votes
2answers
35 views

I'm trying to pull all the text past one point in a file and print it on the screen using bash

This is my input and output: cat /home/$USER/Downloads/cudaHashcat-1.37/cudaHashcat.pot | grep : $6$Tgjtsn2v$dT2el6ZxY9ADYl2WlZE6UdCkDyczwztDoXvtym6KEZv6vkZjNHDbTv.vTVHeQSIrt61uWpbD/gisf3bcET8VK.:...
0
votes
1answer
34 views

Read file upon .bashrc startup, based on date

I'd like to put a script in my startup that reads a line from a text file, and echoes this to the screen. However, I'd like a different line from the file based on what day of the month it is. Thus ...
239
votes
24answers
183k views

Repeat a Unix command every x seconds forever

There's a built-in Unix command repeat whose first argument is the number of times to repeat a command, where the command (with any arguments) is specified by the remaining arguments to repeat. For ...
0
votes
0answers
19 views

Define root prompt and non root prompt in one rc file

I'm writing a restore script for my dotfiles and I find it really irritating that I have to have two .tcshrc for both root and user where they only differ by one line. Is there a way of defining the ...
1
vote
1answer
20 views

Rolling job scheduler

I have a number of servers that I want to perform the same jobs on, one server per day, once the final server has been acted upon the script should return to server1 and start over again. The jobs ...
4
votes
1answer
109 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 ...
-3
votes
3answers
69 views

If, Then, Else Scripting

I have a log file that contains several lines, each with an IP, username, and URL. I need to create something that will take each IP in the line and, if starting with a 10 will append the word "ON" to ...
1
vote
2answers
70 views

how to edit next line after matching pattern and append the line if doesn't exist

I am looking for changing a file content which is repeated twice with that replacement I want to add extra line to second content in the same file Example file User YOURNAME IdentityFile ~/.ssh/...
9
votes
1answer
1k 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 ...
1
vote
1answer
25 views

Find and list duplicate directories

I have directory that has a number of sub-directories and would like to find any duplicates. The folder structure looks something like this: └── Top_Dir └── Level_1_Dir ├── standard_cat ...
0
votes
0answers
14 views

Extract CSV gz file and convert to JSON

Is it possible to extract a CSV gz file stored on an external URL's public_html folder and then convert that data into JSON and then save it as .json in one command?
2
votes
2answers
2k views

Script to get file from SFTP and run it

We have 5 servers running our code: A, B , C, D and E. From a local machine, we sftp the file to A. Then ssh id@A su - applicationname sftp id@A get <file> bye tar -xzf <file> logout ...
32
votes
12answers
12k 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 ...
1
vote
1answer
53 views

uniquely remove unwanted lines in multiple files

I need to remove unnecessary data from multiple output files part of each file looks like this # BLASTN 2.3.0+ # Query: M03117:99:000000000-ALL7G:1:1101:18697:4431_2:N:0:196 # Database: /home/alex/...