Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.).
1
vote
1answer
31 views
Script to ensure that only one instance of Oracle is running
I'm an Oracle DBA and need help/suggestion to understand a weird situation that came up today.
One of our DBA job failing with saying 'Already its running' from Tivoli scheduler. However that is not ...
0
votes
1answer
26 views
Unix, create file based on command [duplicate]
I have a command, but I want to get the results into a .txt file I can open. How do I alter my command to allow the results to be put into a text file. I plan to transfer this .txt file to my local ...
2
votes
1answer
41 views
Rewrite arguments before passing them to a command
I use rtorrent. When using magnetic-links, it creates a "meta"-file (.meta). This gets the form of a long hexadecimal-number (0-9, A-F). For example:
0123456789ABCDEF0123456.meta
To "use" an ...
1
vote
3answers
79 views
how to create a file automatically?
I'm trying to create a script that can:
look for a file containing "foobar" as name
a script is executed on this file and the output must be stored in a new CSV file, which is created automatically ...
0
votes
0answers
32 views
How to use gnu parallel to improve grep within while a loop [duplicate]
I have this loop as you see it makes two greps. The files are huge and grep are very slow.How I can implement gnu parallel in this loop?
while read lemma stem POS
do
date "+%T ${lemma}..."
grep -E " ...
0
votes
0answers
22 views
Server patching email notification linux script [duplicate]
I need to create an email notification linux script which can be used in the server patching activity. I have created one script for the same but getting some errors. Can anyone please check what's ...
0
votes
2answers
24 views
How to output some data to different cells of an Excel File?
Example:
I have a file that has following data:
cvrta2100 Error 404 Fixed
cvrta2111 Licensed Needs Fixing
cvrta2123 Error 404 Fixed
cvrta2333 Licensed Needs Fixing
I am using awk to print ...
0
votes
3answers
70 views
Send command to the shell via Makefile
I'm building a Makefile to automate the start of docker on osx.
At the end of the start docker requires to launch this command on the shell in order to configure the shell: eval "$(docker-machine env ...
1
vote
2answers
49 views
Bash iterate on pairs of files
I have a directory with a bunch of files with names like a04x.txt, each with a corresponding b04y.txt file. I need to be able to run some commands on each pair of files and produce an additional file ...
3
votes
2answers
20 views
Searching /usr/dict/words to find words with certain properties
I would like to write a script to search through /usr/dict/words to find all words that meet some criteria I specify. For example, finding all palindromic words (like "racecar", "madam", etc.) or ...
0
votes
0answers
22 views
How to split a A4 Letter page pdf into 2 4x6 pdfs
I get pdfs in A4 Letter size in portrait orientation, they have 2 sections top and bottom each 4x6. Right side of pdf is blank. I need to spit them into 2 pdfs 4x6 or 2 pages of the same pdf.. Ive ...
1
vote
0answers
21 views
How to make excel interpret Chinese characters in CSV file
I am sending a report from a unix shell script that contains chinese characters.
When I open the CSV report in plaintext editor like textmate I can see the chinese characters but when I open CSV ...
0
votes
0answers
14 views
dialog menu to display files, select one of them and then able to delete it
I want to be able to display files under a given directory, then select one of the files and be able to delete it.
Heres what ive found so far, can anybody help?
let i=0 # define counting variable
...
-3
votes
0answers
34 views
If else statement on shell scripting [on hold]
I want to make a script using if else statement. Example, if the first script abc.sh has successfully executed then it should run the second script def.sh It should 5 minutes after i ran the first ...
3
votes
2answers
42 views
Bash script is not terminated with Ctrl+C
My script cannot be terminated with Ctrl+C key. It is an error.
Please explain how to modify my script to make it terminable by Ctrl+C.
#!/bin/bash
while true; do
paplay ...
0
votes
3answers
75 views
What is the most concise script to list the missing ones in a digit sequence? [duplicate]
For example, we have the content
001
002
004
008
010
in a text file named file, how to extract the missing 3 5 6 7 9?
0
votes
1answer
18 views
xterm no absolute path found for shell
I am trying to run a script in SUSE Linux Enterprise 12 from java using ProcessBuilder. Codes for this follows:
ProcessBuilder pb = new ProcessBuilder("xterm", "-e", "script_path");
Process pr = ...
1
vote
2answers
40 views
Using special character " and ` in send command in expect script
I am trying to execute a command in Linux servers to fetch which all servers requires root password reset as there are multiple servers I am using an expect script to automate it , my command contains ...
-1
votes
0answers
19 views
How can I get a script to run in a menu selection? [on hold]
In vi editor what is the command that you would use to get a script to run when the option is selected?
0
votes
0answers
24 views
script to change an option and show it in a selection
I need option 2 to display Run myscript
when you select option 2 I want it to run my script
can anyone help me
3
votes
3answers
79 views
Bash: Convert a string (version number) to an integer
I want to get the version of glibc and use it in an if statement stating if glibc is less than 2.15 then.
However the issue is that when using the ldd --version this is output as a string. i need to ...
1
vote
1answer
35 views
Is there a way to resolve ALL PIA VPN IPs with a script?
I am looking for a way to get a complete list of all the current IP addresses for PrivateInternetAccess' servers. I need the complete list so that I can manually enter them into a killswitch for ...
2
votes
0answers
11 views
Using a web browser to generate a gallery/slideshow from local files
I'm trying to see how far I can go with using a web browser for various tasks vs. native apps. One of these tasks is selecting a group of local image files and generate a preview/gallery/slideshow in ...
1
vote
1answer
43 views
Why don't the SHA's match?
I am trying to write a script and it uses the SHA of a date but I am getting two different results and for the life of me can't figure out why.
echo -n 03112016 | cut -d'.' -f4 | sha256sum | cut -d' ...
1
vote
2answers
61 views
Rename files in a directory
I have the files names as below in a directory
example1.1.timestamp(.1457644337)
example1.2.timestamp
example1.3.timestamp
and so on about 100 files. I need to rename all the files by removing the ...
1
vote
0answers
31 views
Assigning floating point value to array in Unix shell script loop [on hold]
I am using ksh scripting on Ubuntu 14.04 and am trying to write a script to add floating point numbers to an array. My code is as follows
numLoops=6
numerator=14996288
denominator=1000000000
for i ...
-1
votes
3answers
52 views
Shell scripting : want to login on some server, which are in same domain and execute command and exit
I have 10 unix servers, I want to log into them one by one, execute 4-5 lines of code, save the output and exit.
For Example: 10 serves:
Intially at xyz server
Login in server 1 --> execute 4-5 ...
1
vote
1answer
59 views
What do \t and \a mean in a shell script?
What do \t and \a perform or do in a script? For example, I am writing a script and it goes like this \t it displays a simple script \a
1
vote
2answers
37 views
getting the owner of the folder with the if command
i want to be able to prevent people from accidentally deleting critical files of the system in my my script, does anyone know how to use the statement to find if the owner of the folder?
0
votes
1answer
302 views
Is the xkcd universal install script a good idea? [closed]
Today XKCD posted this shell script:
Alt-text:
The failures usually don't hurt anything, and if it installs several versions, it increases the chance that one of them is right. (Note: The 'yes' ...
1
vote
2answers
56 views
make a shell script to be run as a second user
I am making a script where I wish to run two services as a certain user. The script should switch to a user and then run a program and after the program has been executed, it should start running the ...
-1
votes
2answers
34 views
bash better way to parse string?
I need to parse below command to extract namespace & intf names using bash script, I generally do this using IFS, but that seems tedious to me
is thr a better way of doing this without setting IFS ...
3
votes
3answers
57 views
How can I remove just the writable files in a directory, without any prompt?
I want to delete only the writable files in a directory. If I do
rm *
it removes all the writable files (so far so good), but I get a prompt for each non-writable file. I don't want a prompt, I ...
0
votes
2answers
46 views
Can I have a (bash) shell with expect running in the background?
I am trying to write an expect script that once started will watch my terminal and run a command every time that it finds a match.
Is this even possible with expect? If so, would expect_background ...
1
vote
4answers
52 views
move a file that matches a pattern in a shell script
I have very little experience in writing shell scripts and need advice on how I can accomplish the following task.
I need to move the most recent file in a directory where the filename matches a ...
3
votes
1answer
102 views
Delete lines from a file
I have a file where data is present in below format :
cat file.txt
02|123
04|321
08|453
09|364
01|789
23|765
so here 02,04 ... represents Hour and 123,321 ... represents some random value.
I want ...
0
votes
0answers
23 views
How I compare multiple file results and then using its file result execute the next command?
I run a sql script through atable to insert data from one T1 to T2 (total 8 tables). I am doing row counting between two tables if counts match then it returns 1 else 0 and stored result ('1' or '0') ...
0
votes
2answers
23 views
shell scripts when exceeding 100 seconds to send an email
When executing show engine innodb status on mysql, there are lines like ---TRANSACTION 17610C9A, ACTIVE 504 sec starting index read.
I need a script to monitor for when the number of seconds after ...
1
vote
4answers
44 views
Remove any occurrence of '-' from a field in shell script
below is my csv file,I want to remove all occurrences of - from retailer_id field and create new csv. Kindly help...
...
0
votes
1answer
27 views
command line in su - and background
I am writing a simple unix script to automate reading of a log file.
The following does not give any output to the terminal. It just asks for the password for buser and then it just hangs. I ...
0
votes
2answers
40 views
Compare a file with a column of another file
I have a file File1 with data as
aaa
bbb
And another file File2 with data as:
2,aaa,234
w,bbb,589
4,ccc,675
I need to compare the File1 data with column2 data of File2 and print the matching ...
3
votes
1answer
62 views
VAR=`cat file` and then repeating echo “$VAR” is slower than repeating cat file. Why?
There are about 10.000 files in files/ and 10.000 lines in metadata.csv.
Where metadata.csv contains information about the files.
I have a shell script which prints information about each file and ...
1
vote
2answers
74 views
How to repeat prompt to user in a shell script?
In a set of if/elif/else/fi statements, I have made 'else' present the user with an error message, but I also want it to take the user back to the question which was asked before the if/else ...
0
votes
1answer
28 views
Impossible to write files with root credentials
I'm trying to launch a small script which fixes a bug in iceweasel icons.
Here is the script. You can find it as a workaround in the bug report
for n in 16 32 48; do inkscape -z -w $n -h $n -e
...
0
votes
2answers
60 views
How to use cd command in su command?
In the below script the cases aserver and bserver work fine. But in case "cserver" above, after su - gsxuserp, I need to perform the following three options with the same user.
cd ..
cd ...
2
votes
2answers
68 views
Sorting ls output where files end in numbers [duplicate]
Here is the output of my normal ls command:
f1 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f2 f20 f3 f4 f5 f6 f7 f8 f9
So I have 20 files. I need them displayed as :
f1 f2 f3 f4 ...
0
votes
0answers
17 views
the md5sum command cant find my archive [closed]
I was testing a backup script and when the script attempt to make md5sums for the archive, it keeps saying "File Not Found" while the archive exist and I checked the spelling. Can anyone help, here is ...
1
vote
1answer
50 views
Sed command usage without defining variables in shell script
I have two variables
source_repo="fdl_ppe_01_04_repos_svc"
target_repo="fdl_ppe_01_10_repos_svc"
and I currently do a substitution within an XML file to replace all instances of $source_repo with ...
1
vote
3answers
42 views
Return an exit code without killing caller's terminal?
I'm having a hard time getting the return value from a script. The script that is giving me trouble is second.sh below. But there's an interaction present with a script called first.sh, and that ...
0
votes
1answer
35 views
Trouble with Screen Rotation Script
I am running Antergos linux with Gnome 3.18.2 on a Dell XPS 12 Convertible laptop/tablet, and am working on making the screen rotation more convenient.
I pulled a version of the following script from ...