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)

3
votes
2answers
69 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, ...
0
votes
2answers
41 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
49 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
469 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
520 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
1answer
411 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
0answers
27 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
54 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
44 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
65 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
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
23 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 ...
1
vote
2answers
89 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 ...
0
votes
1answer
40 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
38 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 ...
-2
votes
1answer
45 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. ...
0
votes
0answers
38 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
45 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:...
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 ...
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 ...
-3
votes
3answers
75 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
80 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/...
0
votes
0answers
20 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
1answer
33 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 ...
1
vote
1answer
54 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/...
-2
votes
2answers
39 views

Data Manupulation required your help

I have a data as mentioned below. host_name Server1.domain.com contacts DL - Desktop contact_groups ravi, raj, rahim host_name Server2.domain.com contact_groups DL-Server host_name Server3....
1
vote
1answer
56 views

Using Grep In For Loop

File1 contains: 421 RP-001 421 RP-002 421 RP-003 550 SC-001 550 SC-002 550 SC-003 550 SC-004 550 DY-001 550 DY-002 550 DY-001 550 OU-001 550 OU-002 Script: #!/bin/bash Elogs=/home/elogs.txt ...
0
votes
1answer
38 views

retrieve numbers with 0 for a single int value

In my script, I need to get a 0 for numbers <=9. When the user types any number, I add 5 to it and if the result is less than 9, I need to print a 0 in order to have a 2-digit number (like 07,08,09 ...
2
votes
1answer
34 views

Adding multiple comments to debchange in “batch mode”?

I'm trying to automate a deb package builder for a git repository, as part of which I want to get a bunch of commit comments (since the last package release) and put them into multiple comments in ...
4
votes
4answers
51 views

Running multiple programs in the background and checking their return value

suppose I want to run a few (say, three) programs at once, like this program1 & program2 & program3 & if I want to know their pid's, I think the best way is to store them, like this ...
0
votes
0answers
32 views

Significance of shell script with XML

I have recently joined anew project and experienced the structure where Shell scripts are usually directed to a target which is set in XML and that XML containing action in the tags which needs to be ...
0
votes
1answer
90 views

Bash script to install package if already not installed (From a directory with many packages) - Fedora 17

I have a directory full of rpms (And their dependencies). Currently I am executing yum localinstall ./packages_directory/*.rpm to install all packages in there. It automatically skips the ones already ...
1
vote
1answer
47 views

Is there a way to create a screen windows from shell script?

I am trying to write a script that creates a new screen session and creates 4 windows within it. I am able to create the screen session, finding it difficult to find out how to replicate Ctrl+A+C, in ...
0
votes
1answer
42 views

How to use TWO “for statements” in a shell script?

Writing script to create user accounts. Script is written to echo the useradd command (so I can make sure it will work as expected). I have a file newemploy.txt with Employee Names (first and last, ...
0
votes
0answers
14 views

Automatically set Light and Dark Themes to interchange at Given times

I have a specific setting for my light theme and darker theme to use at night.How can I automate the interchange process.?
1
vote
1answer
81 views

Summarize certain data fields of apache CLF log file

I want to grep some information from raw combined log format apache logs: 51.254.56.62 - - [01/Jun/2016:20:49:28 +0500] "GET /vendors/jquery.slimscroll.min.js HTTP/1.1" 404 - "http://networkconfig....
1
vote
0answers
34 views

Maintaining a window open until completion of another task [closed]

Aim: keep a GUI window open only for the duration of another command/script being run Current Method for this: When current time matches command/script completion time, close the GUI window I'm ...
1
vote
3answers
43 views

Help in separating columns from command into a new command

I'm a noob scripter, and I'm trying to create a script for automatic device creation. I'm pretty far already, but I am stuck at one point. The source file looks like this: dev1 size 1024 dev2 size ...
1
vote
1answer
39 views

substitute at beginning of line

I want to search a pattern and insert a character at the beginning of a line using regsub in TcL. I have to use TcL only Input file mna1 x a1 vss vbn nch_svt_mac nfin=nfin_n1 l=ln1 mna2 x a2 vss vbn ...
1
vote
2answers
47 views

Compare string in two files And Merge its Output

I am trying to get the bandwidth of the domain from one file and its hits details from another file. The format of the two files is as follows: bandwidth.txt aadrivingschool.ws 2840.36M ...
2
votes
4answers
59 views

How do i find over 200K differently named files and output

We have a SAN with a lot (over 5 million) of files. Because of some freak mistake from a developer script, some files have been deleted and we now have to figure out which files got deleted. Now, I ...
4
votes
2answers
72 views

Rename Multiple files gzips them and delete older than 10 days

I'm new to Linux/Unix and slowly learning it step by step. Unfortunately on today’s job interview was surprised by a task to do (which of course I didn’t know). I was asked to prepare a bash script ...
1
vote
1answer
42 views

Point and click Ubuntu 16.04 bash script randomly alternates output behavior

I wrote and tested the following point and click Ubuntu 16.04 bash script for the purpose of completely killing a mono-service RecorderManager.exe process by literally killing the process id returned ...
3
votes
1answer
63 views

How variables inside braces are evaluated

I'm new to shell scripting and I came across these expressions ${var:-val} and ${var-val} ${var:+val} and ${var+val} ${var:=val} and ${var=val} so how are they evaluated and what are the ...
2
votes
2answers
326 views

Run a ping command on list of servers and output to a file

I have a file servers.txt on a different server, with list of servers: server1.mydomain.com server2.mydomain.com server3.mydomain.com I want to first download this txt file, ping these servers and ...
2
votes
1answer
36 views

How can I use sed to snip a line off of a string?

I'm writing a script to display the domain registrar info and I'm trying to snip off a few lines from what I already have I currently have it grabbing all the indented text from a whois. Now I'm ...
1
vote
0answers
21 views

Change existing dovecot maildir installation from m-UTF7 charset to UTF8 to avoid breaking TAB

In an existing dovecot installation with many pre-existing folders using regional characters I would like to change m-UTF7 (.&AMk-l&AOk-ments envoy&AOk-s) foldernames to UTF8 (.Éléments ...
3
votes
1answer
37 views

How to automate mutt in removing old mailing-list emails?

In mutt I perform following sequence of steps: $ mutt -f imaps://imap.example.com username password [shift]+[D] ~C mailinglist1@domain.com [shift]+[D] ~C mailinglist2@domain.com (...) [shift]+[D] ~C ...
1
vote
1answer
46 views

'xz -d' vs. `unxz`

Why is xz -d preferred over unxz when writing scripts? From the man page for xz 5.1.0alpha: When writing scripts that need to decompress files, it is recommended to always use the name xz with ...
1
vote
2answers
58 views

Use variables in here-string

To feed input to an interactive script, I've been using a here-string: script <<< $'1 2\n3 4\n5 6\nq' This effectively enters 1 2 3 4 5 6 q into the script. But how can I replace one of ...