A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.
0
votes
0answers
18 views
find lastly zipped file in a directory which has so many zip files [duplicate]
I am trying to make a script in that i need to execute a command which can give me the lastly zipped logfile(ex:my log file is going to be zipped toady so i need to place this file in script.likewise ...
-1
votes
1answer
29 views
issue while running bash script remotely [on hold]
I created below script to take some backup.When i run it locally or by copying it to remote machine it is running fine.
But when i ran it like:
ssh asuser@isp2876 "bash -s" -- < AdvanceLog.sh
...
0
votes
0answers
51 views
service doesn't work
Background
I am using this script in order to make my script running as service.
I am using Linux Mint 17.3 Rosa.
The problem
Sometimes the start/stop works sometimes not. Sometimes, I have to ...
1
vote
1answer
39 views
KSH script having trouble reading in variables line by line
For starters, I'm not the most advanced scripter. I was asked to create a script that would search through a directory for print files older than 14 days and move them to an archive directory. There ...
0
votes
1answer
25 views
update lines in a file
I have a file,where it has some fields.For example,
var One = "fcb";
var Two = "abc";
How can I update/replace these lines using a script?
I want to be able to do something like :
echo -n "...
1
vote
2answers
20 views
Merge PDF document but with conditions
I make bus timetable booklets for drivers every day, and I have 4 PDF files:
Special Instruction Sheet (Every day different)
Bus daily timetable (which is always different)
Bus Assistant daily ...
1
vote
2answers
31 views
Best way to ensure that a script is run once a period?
I need a certain script to run once a month (others viewing this question may need it to be run once a day/week/year/5-day, etc).
I know I can use cron to do so with:
0 0 1 * * ./script.sh
But what ...
0
votes
0answers
37 views
Curl gets 200 OK, while browser shows 503
I have a bash script:
code=$(curl -I -s -S --resolve $host:$port:$ip $link | grep 'HTTP/1.' | awk '{ print $2 }')
if [ $code -eq 502 -o $code -eq 503 -o $code -eq 504 ]; then
/usr/sbin/service ...
0
votes
4answers
57 views
How can I run a command periodically and indefinitely till it's turned off?
I want to run a command every several minutes until I turn it off.
After some searching, I found lots of ways of doing the first half (running a command periodically and indefinitely), what about I ...
0
votes
2answers
34 views
SFTP to upload files at cronjob
I want to use SFTP to upload files from A to B.
path for A: /tmp/A
path for B: /tmp/B
server B has own username & password.
my cronjob will run every 10 mins to check whether there are new files ...
-1
votes
0answers
16 views
How to run a function for a specific received packet? [duplicate]
I am doing an experiment for my master thesis. I want to run a function (e.g. multiply two numbers) when a specific packet is received (e.g. a packet with destination TCP port 6666). For example, I ...
3
votes
1answer
50 views
tmux script to launch several commands
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
2answers
56 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
2answers
29 views
Passing variables to script [duplicate]
What is the difference between:
./script.sh "$VARIABLE"
and
./script.sh ${VARIABLE}
Is there any?
3
votes
2answers
60 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
38 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
47 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
198 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
268 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
156 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
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
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
42 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
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
...
1
vote
2answers
69 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
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
28 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
43 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
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
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 ...
1
vote
1answer
36 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
70 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
72 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
15 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
26 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
37 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
39 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
25 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
44 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
30 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 ...
-2
votes
0answers
19 views
Merge records in a pipe delimited files when first column value is same, based on the date field in the file
Sample File Input:
CustomerKey|EmailAddress|storeID|preferenceCd1|preferenceCd2|preferenceCd3|preferenceCd4|preferenceCd5|modifiedSystem|modifiedDate
1006374|[email protected]||2R05||||||2015-03-18 06:...
0
votes
1answer
57 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
45 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 ...
-1
votes
0answers
22 views
Loading configuration via putty
I have a NVR hybrid system that runs off of linux. Is there a way I could load a configuration file into this NVR via putty? Basically the file would be a snapshot of a finished NVR with the ntp set ...