A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.
2
votes
0answers
21 views
String substitution in large file
I have two TSV (tab separated value) files -- file_A.txt and file_B.txt
file_A.txt contains two columns -- A_ID, A_Name
file_B.txt contains 4 columns -- B_ID1, B_Name1, B_ID2, B_Name2
Need to go ...
1
vote
0answers
11 views
Creating master process and connecting slave processes
Google-fu failed me on this issue as I have no idea what are the correct keywords and this is my first time encountering such an issue.
I am using Linux Mint and I am trying to run a program called ...
2
votes
1answer
51 views
While loop only runs once [duplicate]
I am writing a simple bash script to check for disk usage on my system. The while loop should only print partitions that are at 85% or above. There are two partitions over 90% but only the first ...
0
votes
1answer
21 views
Fdisk in interactive mode
A few months ago, I had done a .sh script that used:
fdisk image.img <<EOF
o
n
+64M
a
1
t
6
n
w
EOF
It worked a few months ago. Now (a few updates later), it fails:
Command (m for ...
-2
votes
2answers
37 views
Creating and executing a script
Given the task:
Using head and tail, write a command to extract the second section of a file (i.e. the data section).
*I have figured out that: tail -n 52 (path) | head -n 51 , will give me the ...
0
votes
1answer
29 views
Disk Usage Script Displays Wrong Output
I wrote a simple bash script to check disk usage and to send an email alert for all partitions over 85%. I want the output to look like this:
"/dev/mapper/rootvg-root is at 87%. An email has been ...
2
votes
1answer
26 views
How to run a ZSH glob command recursively for sub-directories
I have a ZSH glob command that removes anything but the newest 10 directories within a folder.
#! /bin/zsh
cd /path/to/backups/pod1 && rm -rf ./*(Om[1,-11])
However, this is limited to ...
1
vote
1answer
68 views
Renaming and cleaning up filenames of TV shows to be S01E01.mp4 etc
If I have some TV Shows that are named badly and I need to clean them up
$ ls
Some_Series.1_Episode.1.mp4 'Some Series01.Episode02.mp4' SomeSeries1Episode03.mp4
I need to batch rename them to ...
2
votes
1answer
15 views
Bash script variable dropping output
I run a command at the command line and it works fine. I have added the same command to a bash script and it cuts the output. I have made sure the quotes are correct and I can't seem to see where I am ...
0
votes
0answers
25 views
Search file between two specific phrases and append variable
so I have a bash script that performs multiple tests and executes various commands and compares the outputs to the expected results (in another file). I created a function to save the date and time ...
0
votes
2answers
31 views
Why is my command line copy not working?
I want to copy n1.sh to all folders in SerradoMel/MT10 directory
This is my solution
find . -type d -exec cp n1.sh /home/milenko/SerradoMel/MT10{} \;
But there is no n1.sh in MT10 folders.Why?
If I ...
2
votes
1answer
43 views
Execution of a program called by a shell called by crontab returns code 127
I'm stuck with the following (simple) problem :
I want a script to be executed every 10 minutes. This script calls executable files. I use crontab and ksh on a AIX 5.3 system.
The script makes use of ...
-1
votes
0answers
25 views
shell script to read df output and map each values in to variable
How to read and map individual fields of df -PH output in to variables from a file for example,
Filesystem 1048576-blocks Used Available Capacity Mounted on
/dev/mapper/vg01-...
1
vote
0answers
8 views
Compile a PLSQL package code that was passed to an sqlplus session via a shell script? [migrated]
I have two files: (1) and (2)
(1) A Shell script - wrapper.sh
#!/bin/sh
echo "start of shell script"
FILE_NAME="XX_PKGb.sql"
sqlplus user/password @sql_deploy.sql $FILE_NAME
echo "end of shell ...
1
vote
1answer
27 views
How to programmatically query the Freedesktop application database?
I know about xdg-mime which can query the mapping from MIME filetype to associated desktop application. But this can return mappings to non-existent applications, e.g.
$ xdg-mime default non-...
1
vote
3answers
396 views
How do I rename hundreds of files to all include the same word at the beginning of the filename? [closed]
Here is a small sample of the files I need to rename:
ID_EDMSCP_20160815.txt.pgp
ID_EDMSCP_20160816.txt.pgp
ID_EDMSCP_20160817.txt.pgp
ID_EDMSCP_20160818.txt.pgp
I have ...
0
votes
0answers
32 views
Create a script to keep only the current 3 versions [closed]
I am not a very experienced Linux user and I hope you guys can help me.I am asked to write a script to remove old files(to restore some space on the file system) and keep only the 3 most current ...
0
votes
0answers
9 views
loop to start weblogic servers
i Have this script to start weblogic servers i need to make a loop for all the servers to start them in order like AdminServer WLS_FORMS etc..
i tried this but only the firs one wokring
#!/bin/...
0
votes
0answers
13 views
Pacemaker - Corosync - HA - Simple Custom Resource Testing - Status flapping - Started - Failed - Stopped - Started
I am testing using the OCF:Heartbeat:Dummy script and I want to make a very basic setup just to know it works and build on that.
The only information I can find was this web blog here.
https://...
0
votes
2answers
36 views
print lines with specific words [duplicate]
Say I have two files (file1.txt & file2.txt).
file1.txt: (contains only list of words, one per line)
Car
Ricky
file2.txt: (contains lines (phrases) using words from file1.txt and more)
he has ...
3
votes
2answers
35 views
Combine loop variables outputs together with variable inputs into one line [closed]
var1=( some command together )
echo $var1
myserver [email protected] load24 /dev/tty user1
myserver [email protected] load24 /dev/tty user2
myserver [email protected] load24 /dev/tty user3
...
4
votes
1answer
44 views
How to run script on fstab mount failed and try once more?
I believe the question is clear. But will add some details and history. I have two systems Win10 and Manjaro Linux. After reboot from Windows to Linux, I try to mount NTFS file systems, and mount ...
1
vote
2answers
47 views
Set an alias on Bourne shell
I am using a scrtipt with instruction 'SH -c command', where command is an alias from bash, this alias can not be interpreted into Bourne shell. ¿Do you have any idea for set this alias into Bourne ...
4
votes
1answer
16 views
Script to avoid triggering repeated alerts from a log file
I have a requirement to to develope a bash script to trigger alter for the errors and warnings by reading all services log files. We have nearly 700 services, I use an API to download logs of services ...
17
votes
8answers
1k views
Signed script functionality in Linux?
I was messing around with PowerShell this week and discovered that you are required to Sign your scripts so that they can be run. Is there any similar secure functionality in Linux that relates to ...
2
votes
2answers
55 views
script: Log both output and exit codes
The script command logs an entire shell session to file. This is great, but when reviewing the session I'd like to be able to see the exit code of each command that I ran.
Is it possible to capture ...
1
vote
2answers
46 views
Looping through unix dates
I have rather basic task but wasn't able to find proper solution to it.
I want to iterate date interval since 2008 to current and need epoch values for each iteration of the loop. I am interested in ...
1
vote
4answers
98 views
Test if $1 OR $2 are null with “-z” - BASH
I'm doing multiple raid monitoring in the same script and I want to have the script send alert/go red if EITHER variable comes back null.
I tried reading up and thought I had it, but what I tried ...
2
votes
1answer
34 views
Trim a text without loop
input (in variable as $VAR) :
'yoo' : x'yoo' 'welcome' : x'welcome' 'we' : x'we' 'dum' : x'dum' 'test' : x'test' 'poo' : x'poo' 'D2-dog' : x'D2-dog' 'ant' : x'ant' 'rat' : x'rat' 'xmass' : x'xmass'
...
-3
votes
2answers
39 views
How to return mount point usage(df -h) in excel format in linux scripting [closed]
I want to display the output of Linux command df -h in excel format.
I tried by giving the output file extension as .xls but it returns the whole value in single field.
2
votes
3answers
66 views
Log file grep entries from last 30 min
I am creating a script that will email errors/warnings from a log. I would like to have this sent every half hour but I only want to send it if there is a new entry. How would I grep out only the last ...
1
vote
1answer
99 views
Why is my script slowly using more and more memory? Is it because of midori?
I made a script to display various websites on an infinite loop, and noticed that the system is slowly consuming more and more memory. The script works perfectly otherwise.
From what I was able to ...
0
votes
1answer
74 views
Linux Mint 18 / Update problem/ DNS problem / Run script on startup
I have Linux Mint 18, and always (with Linux Mint 17 too) have a problem with the connection to some repositories in the update option. The solution that I found is to run this in terminal and it ...
1
vote
2answers
383 views
Why do I get the correct results and an error in this bash script?
I'm new to bash scripting and learning "if then" statements. When I run the simple script below it executes and gives me the correct result however I still get an error. The name of the script is ...
0
votes
0answers
25 views
Cron job to delete files older than 5 days based on the file name? [duplicate]
I have a cron tab setup on my linux server, which takes a database backup on daily basis and saves a 1.6+GB .sql file on the root of the server... right now, i have more than 15 backups in the root ...
0
votes
0answers
11 views
how to put self-defined content on the top bar of GNOME
system: fedora 24
top bar: means the top bar of GNOME
It is a little difficult to describe my demand. But i found a app called "bitbar" which is exactly what i want but only for MAC. I want to show ...
1
vote
1answer
116 views
Run local python script on remote machine
I wish to run python script that I have locally on disk on remote machine. I used to run bash scripts like this:
cat script.sh | ssh user@machine
but I do not know how to do same for Python script.
0
votes
1answer
39 views
Getting Variable from sqlplus
I am trying to get a value from sqlplus like below. However, it does not echo what I want. Here is my script:
#!/bin/ksh
OLDEST_PARTITION='sqlplus / as sysdba << EOF
select PARTITION_NAME
from ...
1
vote
3answers
91 views
Need solution for this shell script
still struggling with this shell script (Password Validation), I've search for the solution, but I'm still not find the proper solution.
#!/bin/sh
echo "enter the password"
read password
len="${#...
5
votes
2answers
70 views
Running commands at once
I have text file contain the following commands
command1 file1_input; command2 file1_output
command1 file2_input; command2 file2_output
command1 file3_input; command2 file3_output
command1 ...
1
vote
4answers
117 views
Bash multiplication and addition
for k in {0..49};
do
a=$(($((2*$k))+1));
echo $a;
done
Hi, I need a simplified expression for the third line, maybe one that does not use command substitution.
1
vote
5answers
87 views
grepping array from file and reusing search pattern
I have a project that I am trying to accomplish through shell scripts.
I have some ~30 years worth of directories of a long-running weekly radio show. Because they are from various sources, the ...
1
vote
2answers
28 views
Data extraction problem based on upper case words
I have a data file in the following format:
source.dat (Example for illustration purposes.)
ALBANIA Duck 1000
BELGIUM CHARLEROI Donald Duck 10234
CYPRUS J. Mickey 567
I'm looking for a Linux ...
1
vote
2answers
38 views
Where can I find shell script for parse JSON on busybox?
I have an IP camera with armv5tejl architecture. There I have busybox. I have to be able to parse JSON responses from curl. The problem is that I don't have programs like:
jq, jshon, jsawk...
It is ...
2
votes
1answer
41 views
Bash script to re-run program when it finishes or crashes
This is what I have so far:
until python MyApp.py; do
echo "App crashed... restarting..." >&2
sleep 1
done
This will re-run the program when it crashes, but not when the program finishes ...
0
votes
1answer
40 views
how to update the values in config file
I have an Config.yml file i want to update the values like below by using shell script.
current file data
servers:
- uri: http://localhost:5550/service/mgmt/current
- displayName: server1
- ...
3
votes
5answers
220 views
Comparing multiple options in a bash (string)
I'm trying to enable only certain options when using the read command, and to exit the script if a wrong possibility was entered.
Tried many possibilities (array, variables, syntax change), but I'm ...
0
votes
0answers
24 views
cat: jobs_list: No such file or directory
below is my script generated by a program name "Raccoon". I need to run this script on the cluster. I have to run it with the following command:
qsub script.sh
The cluster generate the following ...
1
vote
0answers
61 views
Task Automation With .EXE program and Bash Script?
There's a Windows program called Visipics. It finds similar images, not merely duplicates. I find it superior to findimagedupes (I use it with Manjaro and Linux Mint) and competing Windows programs, ...
0
votes
1answer
38 views
How to call a script from one file location in another bash script
I have a script named initTEST.ora at location $ORACLE_HOME/dbs. I want to call initTEST.ora script in another script named test.sh which is present in /home/oracle/script.