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 (1)

0
votes
2answers
25 views

Start/stop service script like Ubuntu for RedHat

Is there a .sh script that manages starting and stopping the service like Debian/Ubuntu but for Red Hat/Fedora? Looking to place it into the file running some software.
2
votes
3answers
50 views

Using grep/awk/sed to sort and combine 2 files

Ok I am running into a problem. I am taking a wifi log that has MAC addresses listed in it. I want to find out what MAC vendors/manufactors for the devices that are connected to my router. I have 2 ...
-2
votes
0answers
16 views

Need Script to Find Duplicate PID in a process [on hold]

I need a Shell script to find the duplicate pids in the process. Please advise me Thanks, Srikanth.V
0
votes
0answers
18 views

Sudo command not found, error in jenkins execute shell

When I am executing a command in jenkins job (execute shell) with sudo, it throws an error like this: ..../bin/sh -xe /tmp/hudson7505852448142784880.sh + sudo whoami ...
0
votes
1answer
29 views

How to copy lines in awk command? (ksh scripting is preferred)

I have the below index file key1|1|1001 key1|1|2001 key2|2|3001 key2|2|4001 using this index file, I have to update my main file key1|1000|2000|3000|4000 key2|1000|2000|3000|4000 The ...
-1
votes
1answer
59 views

How to insert the entry into the newline? [on hold]

I have the following entry in a tab delimited file test1.txt key1 10|15 20 30 11|XXX 21 31 Is there any way I can transform this file into the below format? I would like bring pipe delimited values ...
0
votes
0answers
34 views

sed: -e expression #1, char 4: unknown command:

Could someone tell me what does this reply mean ? sed: -e expression #1, char 4: unknown command: ` ' I get it when I use : sed -n "$num"p $javaFile >> ~/Desktop/$1_sql.txt for i in `seq 5 ...
0
votes
0answers
22 views

Copy old cert files and keep the directory path on server

I need to copy old certificate files to new temp directory but keep the directory structure. The certs files are in directories on the server and need to copy all to a temp folder before removing. So ...
0
votes
1answer
21 views

How to setup a display environment?

I'm using MNE (a program to analyse data) in Linux CentOS 6. I upgraded my system to Linux CentOS 7 and after that I was unable to run MNE GUI. Whenever I started the program I'd get the following ...
2
votes
2answers
36 views

saving the output of command line in a text file?

I am using the following command line to analyse data: unpackdcm -scr ${in} -targ ${out} This command is printing on the screen status and description about the progress in the job. In order to ...
2
votes
1answer
22 views

Script Saving the folders names in a text file?

I have a list of foldes in a parent folders how can I save all the folders names in one text file? as the following Parent folder |...A (folder) |...B (folder) |...C (folder) |...D (folder) |...E ...
1
vote
1answer
47 views

reboot in the middle of the script [on hold]

I see sudo reboot in the middle of a script - meaning there are more commands after it. Is there any situation when the commands after reboot can be executed, assuming that reboot is not within an if ...
0
votes
0answers
24 views

Unix Shell script to delete all traces of itself after execution through crontab

My Question has 2 parts. Help with both parts is greatly appreciated. GIVEN INFO: - Lets assume there are 2 Folders, Folder A and Folder B. - Folder A contains many files. - Folder B contains the ...
3
votes
3answers
148 views

Count records matching pattern with Awk

So I was told to do last > lastloggedin which creates a file that shows the classes last login since the last system reboot, and now I am asked to write an Awk script which is named myawk that ...
3
votes
3answers
78 views

How to get whole command line from a process?

How can I get the command arguments or the whole command line from a running process using its process name? For example this process: # ps PID USER TIME COMMAND 1452 root 0:00 ...
1
vote
3answers
87 views

How to sum match numbers

I'm new at scripting, and need some help. Will appreciate your answers. I got this assignment, which is to find the sum of all five-digit numbers (in the range 10000 - 99999) containing exactly two ...
1
vote
1answer
10 views

Locating the terminal currently in use

I need to write a script to test if im using the correct terminal and then print a message This is what i have so far if(???? == dev/pts/1) echo Access Granted. Welcome. endif I dont know how to ...
7
votes
3answers
274 views

How can a Bash script tell how it was run?

I have a Bash script I was trying to make to help me run a rather complex command with small changes that it would ask me about through echo and read. I have found solutions to force it to run a ...
1
vote
2answers
56 views

How can a script run many processes at the same time?

I want my code to run many processes at the same time. The following example for a code and the source is StackExchange (Unix&Linux ) web site. > #!/bin/bash > for i in $(cat lis.txt); do ...
0
votes
0answers
43 views

cronjob executes every minute but should execute every hour [closed]

I have a script which should be executed every hour, which creates a new log file. But it executes every minute. I am really despairing. My entry in crontab -e looks like this: #Create new logfile 0 ...
0
votes
4answers
84 views

Create a list of directories

I have a list of names in a text file (list.txt) I want to create a list of folders for the names included in that file. I wrote the following script, but it doesn't work and I don't know what is ...
0
votes
0answers
14 views

auto installing dropbox daemon(dropboxd) with profile signed in automatically script issue

I am trying to install dropbox automatically in my server auto-install script so when I spawn a new VPS instance I'm able to have dropbox installed and have the credentials already inputed via the ...
1
vote
2answers
64 views

Check that a bash script has exactly two arguments which are directories

I'm writing a bash script that compares two directories, but I'm not sure how to check conditions For example, if the user enters 1 arg instead of 2 (we need 2 since we're comparing two directories), ...
4
votes
2answers
179 views

Run script in a screen

I want to run a bash script in a detached screen. The script calls a program a few times, each of which takes too long to wait. My first thought was to simply open a screen and then call the script, ...
2
votes
2answers
49 views

How can I make a for loop starting a lot of processes?

I want to test some bug, and to do that I need to have a situation where the PID is larger than 99999. I am thinking of a bash script, a for loop. Any ideas?
0
votes
1answer
30 views

Another unterminated 's' command

I am trying to make a simple replacement for an IPv4 address script. sed "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/192.100.100.100/g" This is what I have. As stated in the title I ...
2
votes
2answers
56 views

Compare 2 delimited files and output differences

I have asked similar questions here a couple times in the past with great success, but now my needs have slightly changed and I am struggling to get the exact output I am looking for. I would like to ...
2
votes
3answers
157 views

How do I tell which command has the longest manual on my system?

Is there an easy way to find out which command has the longest manual pages?
1
vote
3answers
128 views

bash script that reads user input and uses “cal” command to validate dates

I want to write a script that reads my input (for example if my script is called "check", then I would type "check 9 4 1993" and that input would go through the cal command and will check through the ...
1
vote
1answer
69 views

One-Click Script to Gmail Yourself a File

Does such a thing exist? I'd be interested in something like: You right-click a file in a file viewing manager, and click "gmail yourself this file". One click, and you're done. You open up the ...
0
votes
1answer
33 views

Shell script permission denied despite +x flag

This is an odd one, it only happens on one server (shared hosting, so I have limited access to configuration and logs), but I can't wrap my head around it. I have a shell script which runs some app's ...
1
vote
1answer
34 views

View timestamp for CUPS print jobs

I'm looking for a way to view the timestamp of a job in CUPS. I've searched the man pages and can't seem to find it. The long term goal is to have a script that parses the time from the jobID and ...
2
votes
1answer
47 views

Using rsync to copy from local to remote server with cronjob, asking for password

I want to copy files from a local machine to a remote machine. I have the command all set up and it looks like this: rsync -a project root@123.456.789.0:~ However, when running this command, I'm ...
-1
votes
1answer
62 views

just wanted to know what am i doing wrong in the end of this script that doesnt put my checkdate in to cal command

#Purpose: Validate a date #Usage: chkdate year month day # if [ $# -eq 0 ]; then echo Usage: chkdate year month day exit 0 fi year=$1; month=$2; day=$3; extra=$4 if [[ "$extra" != "" ...
12
votes
2answers
506 views

How does awk '!a[$0]++' work?

This one-liner removes duplicate lines from text input without pre-sorting. For example: $ cat >f q w e w r $ awk '!a[$0]++' <f q w e r $ The original code I have found on the internets ...
1
vote
1answer
43 views

How to write this replacement with condition

I want to replace now within my working directories the word -> with $\to$ if the word is not within verbatim environment. Pseudocode Replace all entriens of -> with $\to$ everywhere else but not ...
8
votes
2answers
496 views

How to non-invasively test for write access to a file?

In a shell script, how do I easily and non-invasively test for write access to a file without actually attempting to modify the file? I could parse the output of stat, but that seems really complex, ...
2
votes
1answer
183 views

How to remove file log with file name

Assume, I have log files with this name format. NameLog.log.2014-09-27 NameLog.log.2014-09-28 NameLog.log.2014-09-29 NameLog.log.2014-09-30 NameLog.log.2014-10-01 NameLog.log.2014-10-02 ...
3
votes
2answers
89 views

How to write this pseudocode where condition

This question is extension of this question about listing questions of directories. I get a problem that I need to understand the original section of the text. Current output where you see the ...
1
vote
1answer
40 views

ffmpeg script - slicing a video into multiple slices

I am currently using ffmpeg to slice video files. I automated the process through a script called ffmpeg_split.sh. To view the script click here. When I run the script I have an error when trying to ...
0
votes
2answers
50 views

copy and rename script

Directory A: 1111111_1.pdf 2222222_1.pdf 1234567_1.pdf Directory B: abcdefg.pdf zzzzzzz.pdf 1234567.pdf 1111111.pdf 2222222.pdf ...
6
votes
2answers
364 views

What is the reliable way of getting each user's .ssh directory from bash?

I can parse the /etc/passwd with augtool: myuser=bob usershome=`augtool -L -A --transform "Passwd incl /etc/passwd" print "/files/etc/passwd/$myuser/home" | sed -En 's/\/.* = (.*)/\1/p'` ...but it ...
1
vote
3answers
59 views

I want to divide a sum of numbers by a value

So here is my code for Unix shell scripting #! /bin/ksh echo "Enter your first number:" read first echo "Enter your second number:" read second echo "Enter your third number:" read ...
4
votes
2answers
128 views

When is 'if' not necessary?

In some scripts, I've seen if conditional statements written as: if [ some_conditional_statement ]; then # do stuff fi or [ some_conditional_statement ] && #do stuff Is the second ...
3
votes
3answers
188 views

How to copy, execute and retrieve data from a remote computer?

I am trying to run some calculations on a remote computer. Basically I want to copy some files to the computer, load a software, execute the calculation, then retrieve the data back. I have created a ...
2
votes
1answer
36 views

Interacting with webpage through script?

I have an email-account where I've ended-up with a lot (200 000) of messages in the Spam-folder. Unfortunately, it's not all spam - partly due to badly trained filter and partly due to mail-list ...
2
votes
3answers
75 views

How to sum times in a text file using command-line?

I have a text file containing flight times, hours and minutes separated by colon sign, one per line: 00:50 00:41 00:43 00:50 01:24 I am currently using Apple's Numbers application with a simple ...
0
votes
2answers
25 views

merge mutiple files using common column [duplicate]

Say I have multiple files x1, x2,x3,x4, all with common header date, time, year, age. How can I merge them to one singe file X in shell scripting? File x1: date time year age 101014 1344 2012 52 ...
2
votes
2answers
45 views

Interacting with a running interactive console program from a different process

I have a console program with an interactive shell, similar to say, the Python interactive shell. Is there an easy way to start this interactive program A and then use another program B to run A? I ...
2
votes
1answer
53 views

Get the full window dimensions (including decorations) in Unity

I have used the answer to How do I find the window dimensions and position accurately including decorations? in my bash scripts, and had good success with my Silentcast application on Xfce, but now ...