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
1answer
26 views

How to pipe binary stdout to a compressed tls connection?

Not so long ago, I could use : cat somefile.txt | openssl s_client -connect server:port -quiet -comp However, this command doesn’t work, even with-ign_eof: $ cat somefile.bmp | openssl s_client ...
0
votes
1answer
21 views

To create shell script

I want to create a script to check size of all the files present under particular folder, and if size of any file present under a folder cross 500mb it would trigger a mail to me specifying the file ...
1
vote
1answer
17 views

How to pass array to bash shell script?

How do I pass an array as a variable from a first bash shell script to a second script. first.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') sh second.sh "$AR" # foo sh second.sh "${AR[@]}" # foo ...
1
vote
1answer
14 views

Accessing array index variable from bash shell script loop

I want to access the array index variable while looping thru an array in my bash shell script. myscript.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') for i in ${AR[*]}; do echo $i done The result ...
0
votes
1answer
18 views

How to run a shell script from an AppleScript?

I am using a Mac running OSX Yosemite v.10.10.5. When I try to run my shell script from my AppleScript, I get the following error message: Error message at AppleScript Script Editor error "sh: ...
0
votes
0answers
27 views

Shell script - Unable to copy file from one older to another

I need to copy the files from one folder to another, here source and destination information are in the text file. File content: resconfig.txt cp -f /var/lib/jenkins/jobs/Android\ Gradle\ test\ ...
0
votes
1answer
19 views

Shell Save the array element values in the variables

I need to copy the files from one folder to another, here source and destination information are in the text file. File content: res.txt /var/lib/jenkins/jobs/Android\ Gradle\ test\ ...
0
votes
1answer
23 views

Bash script to find content of file in a directory and add value

I have a directory with a huge number of files. I want to write a bash script to - Enter that directory Find out which of them are Perl scripts (but none of them have a .pl extension) Add a line at ...
-1
votes
0answers
13 views

Search content of odf (odt|ots|odp) documents from command line

I want to search the content of some odf document (Libre Office document) from command line. I want something like: odfgrep <search-pattern> <file-name> I found something of interest ...
0
votes
2answers
22 views

Evaluate each environment variable and set it back in ubuntu

I'm trying to write a shell script which reads all the environment variables, evaluate them for included env. variable with in them and re-export after evaluvation. Example - I've an environment ...
0
votes
1answer
19 views

How to programatically modify systemd unit files?

I'd like to edit a systemd's unit file from a shell script. I want to change the unit's only ExecStart line. Using systemctl edit looks smart to me, but the command needs an editor set as ...
1
vote
0answers
13 views

Detecting new USB devices with bash?

I'm writing a bash script that needs to detect when a usb storage device is inserted and assign it to a variable that would otherwise, typically look something like: usb=/dev/sdb. I have a few ...
0
votes
1answer
45 views

searching the string with the time in log file using shell script by passing variables

I want to search a string and subtract the time that is found from the current time. When used, the script should show the lines from that time or from the very next log time frame. I'm able to ...
0
votes
0answers
31 views

PowerShell Script is not digitally signed

I am trying to call a Powershell script from another Powershell script. When I try to execute the script, I receive to following error message: After researching the error on Google, I entered the ...
0
votes
3answers
57 views

Shell script Copy file from one directory to another not working

Hi I am trying to automate the android build system through jenkins. Here I am trying to copy the image file from one directory to another directory but always getting " No such file or directory" ...
0
votes
1answer
41 views

Shell Script excuted fail in Linux at command

When I run a Linux "at" command,I find the user's shell script executed fail, for example,I write the following code in my script #!/bin/csh #or #!/bin/bash echo "Now will excute a shell script" ...
0
votes
1answer
41 views

Shutdown a linux computer depending on the battery level

Is there a way to shutdown a linux-based computer when the battery charge drops below a certain level? I have searched through the shutdown and poweroff manuals but found nothing relevant.
0
votes
1answer
22 views

How to run script in same session without exec?

I have below script to set me in my project:- #! /bin/zsh source ~/.zshrc crld #alias for Project base cd Kenneth_Love/survivalguide workon kenneth_tutorial This script works but doesn't drop me ...
0
votes
2answers
59 views

How to POST file contents using cURL?

I want to do an HTTP POST of the contents (as a string) of a local file located at path/to/my-file.txt to a URL endpoint at http://example.com/. For example, I might want to do the following: ...
-2
votes
3answers
281 views

How can I write a bash function that checks if an integer is even or not?

How can I write a shell predicate function event that takes an integer argument and tests if it's even or not?
0
votes
2answers
27 views

new column to a tab delimited file, with as predefined value

How can I add a new column to a tab delimited file, at the end of the file, containing the same values for each row. For example: infile.txt Name Age Address Sex X 12 adrs1 M Y 15 adrs2 ...
2
votes
1answer
49 views

Merge only new entries from one xml file to another

I have 2 xml files. The 2nd file has some new entries including same entries as that of the 1st file. Examples of the 2 files are given below. File 1 <SERVERNAME_ONE> ...
0
votes
1answer
49 views

arithmetic operation on a nested column in a tab delimited file

I have a tab-delimited text file containing Column1...Columnn columns and R1 to Rn rows. Within some of the columns, there are multiple nested fields with an identifier and then separated by semicolon ...
0
votes
2answers
56 views

simple arithmetic operations on a tab-delimited text file in shell script

I have a tab-delimited text file containing C1...Cn columns and R1 to Rn rows. Column 10 (C10) has a field 'X'=four comma separated integer values (X=a,b,c,d). I would like do a small arithmetic ...
0
votes
1answer
30 views

how to write a shell script to take password automattically after the execution of command

#!/bin/bash cd /var/SUNWdsee/ds6/bin ./dsconf show-repl-agmt-status -e suffix Hostname:389 Above is my script. After the execution of the last line it will prompt for password in screen. I need to ...
0
votes
1answer
40 views

dos2unix command is corrupting the file with unicode characters downloaded via binary mode

i downloaded an xml file having unicode characters from ftp in binary transfer mode. In order to remove the line ending special characters i used the command dos2unix. But this is making the file ...
0
votes
0answers
11 views

cronjob not finding commands [duplicate]

I am running (and also new to) OS X El Capitan. I have a user cronjob that is using some basic commands that I got via brew. wget and s3cmd I have the cronjob executing a shel script in my user bin, ...
1
vote
0answers
40 views

Colon(:) operator in Unix shell

As far as colon is concerned i understand that is is used in certain situations as a null and as a parameter of expansion for substring, but can someone explain me this: do_qc: $(STAGE1_OUT_FILES) ...
0
votes
0answers
22 views

Bash to dos conversion trouble windows path cygwin

I am having a problem with this script that is run through cygwin using a bash script. I need to run this script using a direct network path which is shown in the second snippet of code. #!/bin/sh -p ...
1
vote
1answer
20 views

pass du (disk usage) result to a numeric variable

In a shell script, I'm looking for a way to pass the du (disk usage) result to a numeric variable, so that I cantie the execution of a shell script to the size of a specific folder. I've tried ...
0
votes
0answers
11 views

Automate creation of content and sending mails from template and list of required variables

I have a list of so many users with their email ids Names Mohit Shrivastava Axyee Jackson ... Corresponding email ids mohitemail@domain.com axyee@domain.com ... I want to send all of them ...
0
votes
1answer
30 views

Rename folder on remote server

I am calling a .bat file which contains the following command net use \\128.545.k.k\E_Drive /user:Username psw to connect to a remote server. I would like to rename a folder on the remote server i ...
1
vote
1answer
47 views

Emacs: suppress indent after && in shell-script-mode

In shell-script-mode, when a line ends in &&, Emacs will indent the following line. Is there a way to switch that off? (I am concatenating most of my statements with &&. This gives ...
0
votes
2answers
31 views

Unable to add spaces

How can i add spaces between my outputs using sed/echo or any other command in linux? Preferred Output: Virtual Machine Test01 status Running. Virtual Disk Test01 size 61GB Physical Disk ...
0
votes
1answer
24 views

Duration time between cycles in a log file

My apologies if this is too basic, but I have a log with this kind of information: Mai 5 12:34:00 xoengine XO[1287]: [Xo|xoengineMain.cpp:122|0xb88ec60] starting xoengine 4.0.1.2 (x86) from ...
0
votes
1answer
43 views

Cannot execute ssh-ed osascript properly inside of shell script

I have created a ip-down script in my etc/ppp/ directory. Essentially I am trying to kill certain programs/servers when the VPN disconnects, then display a notification on another computer via ssh. I ...
0
votes
0answers
28 views

Sed command to replace NUL character in file

I am using the command sed -i 's/\o000//g' filename or sed -i 's/\x0//g' filename to remove the NUL character but the command works fine in DEV environment but doesnt work in UAT. OS and sed version ...
1
vote
1answer
56 views

The “other” finger (GECOS fields at /etc/passwd)

in the file /etc/passwd we have the so called GECOS fields (which stands for "General Electric Comprehensive Operating System"), that is: username:password:userid:groupid:gecos:home-dir:shell ...
1
vote
2answers
50 views

Escaping “=” (equal sign) in for /f

I'm trying to run the following command in a "FOR /F" in Windows' shell... wmic process where ParentProcessId=%%PID%% get ProcessId The = between ParentProcessId and %PID% keeps gettings replace by ...
1
vote
1answer
31 views

How to chain a group of commands in Fish like { … } Bash?

I'm aware of chain Fish commands via && or || but I'm willing to chain a set of commands Code env git clone --depth=1 https://github.com/rafaelrinaldi/theme-pure.git; or { printf "Error: ...
0
votes
1answer
97 views

How can I send email with attachment xls file using shell script as application/xls mimetype without making the received file becoming unreadable

#!/bin/bash ATTACH1=file.xls<br> SUBJECT="subj"<br> FROM=me@domain.com<br> TO=you@domain.com<br> CC=them@domain.com<br> MIME="Application/vnd.ms-excel" <br> ...
0
votes
1answer
49 views

Feeding multiline input (here documents) to commands in cmd.exe scripts

In Bash, I can do something like this somecmd << END a lot of text here END to feed input to a command directly from a script. I need to do the same in CMD.exe batch files (.cmd scripts). Is ...
0
votes
1answer
41 views

How do i get rid of command not found?

I am new to shell script and I currently am facing an issue that I can't solve which is there is this. This is the error: vmw_ubuntu@vmwubuntu:~$ BookInv /home/vmw_ubuntu/BookInv: line 155: [=: ...
2
votes
2answers
42 views

compare and calculate two variables with multiple values in shell script

I have written three hive queries in shell script for calculating debit-credit and target amounts which output below values: debit_amount : BOI 4760545.650000 AXIS 284.49000000 SBI 87.220000000 ...
0
votes
1answer
42 views

How to find files modified in last 24 hr but do not find from hidden directories and sum them

I have following command to find files modified in last 24 hr and sum all of them. #!/bin/bash find /mnt/naspath -mtime 0 -print0 | du --files0-from=- -hc | tail -n1 >> /tmp/size.log exit 0 ...
0
votes
2answers
46 views

Fetch required column from a file with \001 delimiter

I am storing output of pig file in a directory Which contains lines with multiple columns separated by delimiter \\u0001. Now in shell script I want to fetch 7th column field from the output. I ...
4
votes
1answer
23 views

Using libjasypt on Ubuntu

When I install libjasypt with Ubuntu, where does it install, and where can I find the encrypt/decrypt.sh scripts? I used the following command to install jasypt. sudo apt-get install libjasypt-java ...
0
votes
1answer
25 views

To print values in diferent line in mail body shell script

Below is the code to print contents of files present in the directory File contents are : apple banana grapes mango names=() FILES=/path_to_dir/* for f in $FILES do names+=($f) done ...
0
votes
1answer
37 views

bash script read line by line

Hello I am trying to create a script that reads my file take all the variable it needs then use it for another command. But it seems that the variables are not being memorized, because I tried a ...
0
votes
0answers
17 views

Shell Scripting - Mac - Emailing

I'm just messing around with shell scripting after doing some in the past, and I have figured out how to Email myself from writing a script by using: mail -s 'Backup status' ...