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
11 views
create script that backup files base on directory date
Hi have a centos system that build directories for each year,month,day,hour.
I need to create a script that backup the directories and subdirectories base on the day the crontab is running.
For ...
-2
votes
1answer
18 views
How Mount a datastore on linux in python [on hold]
New to python,
I need to mount xyz/pqr/ datastore on my linux mychine for in my python script,
please help me out with this from scratch.
0
votes
0answers
13 views
Piping: Continue to next input even if something goes wrong with the current one
I have a script to hit few URLs like this
awk '{print $7}' /var/log/access.log | sort | uniq | xargs -n1 wget -i - -O –
Every now and then the log file has something that isn’t a URL and wget ...
-1
votes
1answer
25 views
Why isn't the ping command recognized by my bash script? (using Kali) [on hold]
I'm following along the book "Penetration Testing: A hands-on...." and have hit a road bump in executing this simple bash script.
The script basically looks pings all 254 hosts on the designated ...
0
votes
0answers
10 views
Turning Monitor Off Without Locking
I'm trying to find a command or a script that would allow me to turn my monitor off without locking my session. I've already tried xset dpms force off and xset dpms force standby according to this, ...
2
votes
1answer
37 views
How to (Memory Limited) > grep -F -f file_A file_B >> output.txt
file_A (~500MB, 1.6M lines) consists of all equal length search terms, 1 per line, not sorted.
file_B consists of all equal length text lines, 1 per line, not sorted
I've been able to run "grep -F -...
0
votes
4answers
59 views
Reading set of lines from a file
I have a file of 1000 lines. I need to read that file 10/20 lines per time and execute those or save it into other file. Next time it should read the file from 11/21 and do the same.This should be ...
0
votes
2answers
21 views
Running a command with multiple inputs for many files
I need to run a program using 2 files as input expecting 1 output having 6000 files ranging from abc0000.faa/abc0000.fna to abc6000.faa/abc6000.fna. I also need the output file to have the same file ...
13
votes
5answers
977 views
Running a command on many files
I've got a folder with many files (xyz1, xyz2, all the way up to xyz5025) and I need to run a script on every one of them, getting xyz1.faa, xyz2.faa, and so on as outputs.
The command for a single ...
1
vote
0answers
12 views
Run script in the host when starting virtual machine with virt-manager
This is related to my question on Ask Ubuntu: Add physical partition to QEMU/KVM virtual machine in virt-manager (see "Updates" near the end, if needed).
Is there a nice way to run any arbitrary ...
0
votes
1answer
24 views
line at a time work progress filter for scripting
So lets say I have a script that works on groups of files, and does several different sorts of operations.
Printing out a filename as it gets processed helps give an idea of how well things are going....
1
vote
1answer
11 views
Timing out in scripts with usbmount
I have created a script that would do certain tasks that will take quite a while. The script is ran when a device is mounted with usbmount but it turns out there is a timeout limit.
systemd-udevd: ...
0
votes
2answers
17 views
Extract values based on pattern out of a line/list
I have list extracted from a json output as below.
"Rel_70" "Rel_71" "Dev_795" "Dev_796" "Dev_797" "Devtest_10" "Devtest_12"
Out of this, I want to extract values with Dev_* i.e I am interested to ...
1
vote
1answer
45 views
Why a combination of tail+grep+cut doesn't work? [duplicate]
I wanted to grep some logs, while tailing them, and print only a part of each line, since the lines are too long.
I can't figure out why the combination I use doesn't work; the procedure follows:
...
0
votes
0answers
16 views
Cannot skip * in a concatenated echo command hence wrong output [duplicate]
Two more more echo commands resulting in '$*' sequence and hence instead of replacing a string with * opc, it is replacing with files in the directory and opc.
echo $(echo "AllowUsers" "$(echo "$CMD1"...
2
votes
2answers
32 views
Max out file descriptors
I wish to write a script that will use up all of the available file descriptors on my Linux machine. I am unsure how exactly to do this, or if it is even possible? But I wish to use this script for a '...
-5
votes
0answers
16 views
Script for backup archiviation [closed]
I have a RHEL machine running Webmin with MySQL module active, in the backup section i can save my db's in TGZ format every day..or every x hours. The problem is that: every time Webmin do the job it ...
1
vote
2answers
44 views
How to extract the number of physical processors and threads per core? (No text, only the number to use as input elsewhere)
I want to use the number of cores in a script and I am not sure what is the best approach to extract the number itself.
For example, the below extracts the number of physical cores, however how ...
0
votes
2answers
32 views
Scope of for loop control variable in shell? [closed]
I have a question about for loop in shell.
Let's assume this simple shell script:
#!/bin/sh
loop() { ...
-1
votes
0answers
27 views
How to get the record count from multiple tables by using shell script
I need to create a UNIX shell script to get multiple table counts from hive by using Beeline command prompt. based on the number of tables query need to build dynamically by using union all like below....
1
vote
6answers
55 views
Adding up every 5 lines of integers
I am writing a parser, and have to do some fancy stuff. I am trying not to use python, but I might have to at this point.
Given an STDOUT that looks like this:
1
0
2
3
0
0
1
0
0
2
0
3
0
4
0
5
0
2
.
....
0
votes
0answers
10 views
Running lacobrts with Unix script
I have a Unix script that runs a Lawson program using the lacobrts command. I keep getting a return code of zero. If there are errors within the data, I still get a return code of zero. Is there ...
1
vote
4answers
67 views
Is the bin/ directory for storing binary files?
I have seen many tutorials saying that the bin directory is used to store binary files, meaning there is only 0 and 1 in the files in that directory.
However, in many cases, I see files in bin that ...
0
votes
0answers
21 views
linux and Python
I have a python file in which the code spawns a child..after spawning the child...the code exports an environment variable(i.e.send this command to the child)...I then call a bash script..(which is ...
1
vote
2answers
34 views
Find and Update cron entry, via script
I'm trying to add a piece of code to my script that will update its own entry in crontab. So far, I've been working with with the following:
crontab -u root -l | grep -w "$VAR" | crontab -u root - &...
0
votes
0answers
12 views
Can I use the bareos-database-common debconf values to install the bareos-database-mysql package without prompts?
I obtained a list of debianconf-get-selections values below:
# storage directory for bareos-database-common:
bareos-database-common bareos-database-common/db/basepath string /var/lib/bareos
...
0
votes
1answer
20 views
How can I filter out files with 1GB or more with Date Range .
Can anyone suggest me script or command to find out the file with size more than 1 GB with date range like May 01 to May 31 .
Please help me to create the script or command .
I want to move all ...
1
vote
2answers
40 views
Increment the last part of a variable name
I have just registered here.
I am working on a script which puts data in an array into separate variables.
Example:
for((i=0; i < Counter; i++)); do
while read -r Parmfilesjobid; do
...
3
votes
2answers
55 views
How to increment column using AWK
I have the following file pattern:
insert_buffer cell_a
insert_buffer cell_b
insert_buffer cell_b
...
I want to add one more column to the end of each line with incremented number. e.x. 0,1,2,3...:
...
2
votes
3answers
56 views
How are multiple commands given for ex from the command line?
I'm looking to use ex mode of vim for a script I'm trying to write, but I can't seem to figure out the syntax that will allow me to write multiple commands.
My code looks something like this:
ex -c '...
0
votes
0answers
10 views
SWIG problem with Tcl and C [migrated]
I have a simple example I'm trying to follow but I run into a library error at the end.
Example.cxx
/* File : example.cxx */
#include <stdlib.h>
#include <tcl.h>
#include <math.h>
...
3
votes
1answer
56 views
Copy a block of text to a specific point in another file
I'm trying to figure out how to move a block of text from one file to a specific point in another. I have a large amount of files that looks like this:
H -9.92247800 1.33807800 -...
5
votes
5answers
193 views
Is there a terminal command that navigates to the deepest sub-directory in a directory?
What I mean is that, suppose we have the following directory
Dropbox (folder)
---> Bob (folder)
-------> 2017 (folder)
------------> images (folder)
----------------> image.png (file)
I could do ...
-1
votes
2answers
49 views
How Do I include the “ > ” in this if condition | Bash Script
date=$(date +'%d-%m-%y')
mkdir -p $date
echo "Enter DB User";
read DBUSER ;
echo "Enter Password" ;
read PASS ;
echo "Enter DB Name" ;
read DBNAME ;
echo "Enter Dump file name with ....
1
vote
2answers
46 views
Add string after a certain string in the same line in a text file
I have been trying to add a string in the same line in a text file. I have used following method.
sed -i "s/\bmembers\b/& \t$host,/" printer.cfg
It will add a string after members string and ...
1
vote
2answers
39 views
Bash script arg0 vulnerability?
Is it possible to change the $0 argument of a shell script (bash script) explicitly while running the script?
Consider the following script:
readonly SCRIPT_HELP="$(cat <<EOF
Usage: $(...
1
vote
3answers
49 views
Loop shell script if the input file has more inputs
I have a shell script and I have provided answers for the script through answers.txt file.
echo -n "Enter your name: "; read name
echo -n "Enter your number: "; read number
echo "Your name is $name ...
0
votes
0answers
39 views
Extracting text blocks based on grep output
I'm currently working with a text file that contains the following text blocks:
--------------------------------------
Beginning of block
Text
Random Text
keywordA
Text
End of block
------------------...
0
votes
1answer
38 views
What is the most ideal way to pass a command line argument/option to be used in a script? [closed]
I need to write a script that takes user input at the command line and use it in the shell script. For example, create a script that will accept the command line options of -u (user) -r (number). I ...
3
votes
2answers
57 views
Update or append JAVA_HOME with sed
I am scripting my new VM stack and I am trying to update or append JAVA_HOME in the ~/.bashrc file
I've managed to do that by running the following sed command from the command line.
sed '/export[ ]...
-4
votes
2answers
29 views
$ sh < foo > bar this statement is the question [duplicate]
What this is the following command doing? I'm new, and still learning.
$ sh < foo > bar
How to interpret it step by step so that I can get clear understanding more question like this.
0
votes
2answers
27 views
Merging folders with a script
I have a list of 417 folder paths that I need to merge in a specific order so that files in them overwrite each other. I'll probably need to do it again in the future when I make changes to the folder ...
0
votes
2answers
77 views
Shell script to set password for samba user
I would like to set a password for setting up samba share directory using a shell script. I wrote the following script test.sh:
#!/bin/bash
pass=123456
(echo "$pass"; echo "$pass") | smbpasswd -s -a ...
6
votes
1answer
36 views
Whenever ansible makes changes to sshd in CentOS7 a random future play cannot connect
This has been an irritating enough problem now that I thought I would finally ask the community at large what a possible solution might be. It's even more irritating that I seem to be the only one ...
1
vote
1answer
24 views
Is it possible to create with FFMPEG a series of pictures with continuously shorter duration?
The most simple slideshow is just a sequence of pictures with each being displayed for the same amount of time.
I would also like to make a sequence, but more complicated with respect to the duration:...
-1
votes
2answers
51 views
Bash Script Problems
I'm working on a script... I don't know what is wrong with it...
!#/bin/bash
while="true"
while ($while == "true") do
clear
echo "What game would you like to play?"
echo "1. Tetris (bastet)"
read ...
0
votes
0answers
60 views
How to search and replace text using awk linux script?
I want a single CGI file that I can run on Cron that just does a simple search and replace on two small text files on my HostGator server, running Linux.
In one directory on my server, I have a text ...
0
votes
1answer
43 views
Open URL in new firefox window not tab in a bash script
I want to open a URL in Firefox always in a new Window and not in a new tab.
It is on my raspberry PI on iceweasel and I just can't find a soultion for my problem.
What do I have:
firefox -private-...
-1
votes
2answers
40 views
How to evaluate concatenated string involving math in bash script
I am trying to get these strings as output for items other than zero:
[21-40]
[41-60]
[61-80]
[81-100]
But the following script is somehow trying to evaluate the contents of the _FILENAME variable.
...
1
vote
1answer
48 views
Case Statement Nested in While Loop causes Infinite Loop in BASH Script
I'm trying to make this BASH script require the user to input a value between 1 through 4 to choose a ninja turtle in the case statement. Any other value will cause $COUNTER to remain equal to 0 ...