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
2answers
22 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 ...
-3
votes
0answers
33 views

How Can I Find All The Script Files on My PC? [on hold]

The previous contents (referred to by one critic as being "My life's story"_ has been moved to file 000.txt at https://my.pcloud.com/#page=filemanager&folder=63120803 Now I am leaving the part ...
0
votes
0answers
16 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 ...
-1
votes
0answers
19 views

Unix/Linux email notification

echo "This is the body" | mail -s "Test POC Mail" $sender_mail echo "Mail is sent" when I run this script, it is giving the last statement in the console but am not receiving the email and I set the ...
0
votes
1answer
23 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 ...
-4
votes
0answers
28 views

How to use apt-get to check if a package is installed?

I have a shell script which checks for some dependencies and installs them if not installed. DEPENDENCIES TO BE CHECKED : git-core, build-essential, libncurses5-dev All these packages get ...
0
votes
0answers
17 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
24 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
22 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 ...
0
votes
1answer
15 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
31 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
16 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
35 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
29 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 ...
1
vote
0answers
28 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
0answers
12 views

fetch required column with delimiter from files in shell script

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
20 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
21 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
35 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' ...
0
votes
1answer
29 views

Getting output of another script while preserving line-breaks

I'm running a C program from a bash script and would like to capture the last line of output and the exit code. This is what I did: echo output=$(echo $op | ./compute) echo $output echo "$output" ...
0
votes
1answer
36 views

shell script to append text in csv files based on constraints

In my project, I have so many files named “config.csv”. My requirement is to add a Configuration at the end of the file based on certain constraints. - Get All config.csv files across the project. - ...
0
votes
0answers
22 views

How can I disable/enable multiple hardware components with a single command?

I am a web developer/designer during the day, but at night I play DJ gigs. For music, I need several hardware components disabled. Then, after the gig, I reenable all of the hardware. Each of these ...
0
votes
1answer
48 views

Shell Script to pass arguments to another script

I am new to the linux and shell scripting. I have a script, which has some read commands in it. So, something like #script1.sh echo "something here" .... read var1 read var2 ... Now, i want to ...
0
votes
0answers
9 views

Triplicate entries of a column

I have a data column with over 2000 entries... MV1 BNV CMG IKN ... ... I want to triplicate each entry in the column format. Result should be; MV1 MV1 MV1 ...
0
votes
1answer
24 views

Substarct two float numbers in shell script

I have written shell script to substract two float values For eg. below are the two values : debit_amount=7.853117806000353E7 credit_amount=3223649.619999993 val1=$(printf "%f", "$debit_amount") ...
1
vote
2answers
44 views

Is it possible to check whether -e is set within a bash script?

If a shell function needs a specific setting of -e/+e in order to work, is it possible to set that setting locally and then restore it to its previous setting before exiting the function? ...
0
votes
1answer
49 views

Scan for duplicate files with different extensions

I am looking for duplicate file names with different file extensions. Here is the command I run: find -maxdepth 2 -type f \( -name "*.avi" -or -name "*.mkv" -or -name "*.mp4" -or -name "*.mpg" -or ...
2
votes
1answer
43 views

Replace a nested LaTeX command with multiple arguments

I'd like to replace the LaTeX command \teilseiten{left col width}{left col text}{right col text} by an nested environment. The problem is, that the second and third argument of \teilseiten contains ...
-1
votes
2answers
40 views

Shell program not working properly

I wrote a simple script to check if the deluge daemon is running and if not to restart it: #!/bin/bash if [[ $(pidof deluged | wc -1) -eq 0 ]]; then deluged fi I added it to scheduled job on ...
0
votes
2answers
48 views

Get the display resolution a window is on in a multi monitor set up

I have a 3 monitors set up (one is 1080p, the other 900p). I'm editing a window tiling bash script that needs to retrieve the resolution of the display an active window is on. ...
2
votes
0answers
30 views

tcsh: how can we display the body of a foreach loop in history

I see that history doesn't display the body of loops. Is there a way to show them? san: cd /tmp/test san: touch abc san: touch def san: ls abc def san: foreach file ( `ls` ) foreach? echo "File is ...
0
votes
0answers
50 views

replacing special characters without using escape sequence in unix file

I am trying to replace a string with special characters like " &,*,@" etc. This should be done without using escape sequence. I am using sed but it is not working without escape sequence. I am in ...
-5
votes
3answers
48 views

./command <<< several arguments

If I have a program called "prog" that requires only one argument, I can write: ./prog <<< 1 But if I have a program that requires 2 arguments why doesn't this work: ./prog <<< 2 ...
2
votes
3answers
73 views

How to fetch address and modify the value in key/value format file?

I'm currently writing a shell-script for my Raspberry Pi so it sets up an access-point with a unique SSID. To do this I want to use the mac-address of the WiFi dongle as my SSID. For doing that I want ...
0
votes
2answers
54 views

BASH string manipulation, syntax errors

I have search though many sites, I cant seem to find my problem, down vote if you must but it wont help me at all ./script: line 1: #!/bin/bash: No such file or directory enter ip >>> : ...
2
votes
1answer
23 views

How to do floating point operation in shell script

29/0.060 Is there any way to do above floating operation in shell script. I tried these awk '{printf $1/0.060}' <<<29 It works fine, awk '{printf $1/0.060}' <<<$test where ...
0
votes
3answers
86 views

How to escape binary data for inclusion into bash script

I want to create a bash script that reads a "payload" of binary data from an external file and spit out another bash script with this data escaped and encapsulated inside a string variable. Example: ...
0
votes
0answers
30 views

I want to run a script that will disable my touchpad

I want run a script that will disable my touchpad and it will run every minute. 1. My script is: if [ `lsusb | wc -w` == '76' ] then `/usr/bin/xinput set-prop 16 "Device Enabled" 0` else ...
-1
votes
1answer
35 views

How to use bash script with tmux terminal?

I use tmux with shortcuts provided by the program. How can i use my shell script for performing several options e.g:check if session exists etc.
1
vote
0answers
49 views

Get filename from a wget --content-disposition

Inside of a bash script I am dynamically downloading a file and so I use wget --content-disposition to ensure the file names are correct, but how would I go about retrieving the name of the file wget ...
1
vote
1answer
19 views

An issue renaming logs with MV

I’ve got log files that are created as log.2015-09-28T13-36-29 and I’m trying to change the names of the log files to better suit logrotate. The following command works to display the file I need ...
5
votes
2answers
269 views

How can I excute my bash shell script from any directory?

I have a shell script at /home/joey/hello.sh Now, I want to execute it anywhere like pwd, cut, sort, grep. So, I just type hello.sh although I am in another directory.
0
votes
0answers
25 views

how does ' =~ ' functions in shell scripting?

I want to understand what is the use of =~ regex function? Both the below mention scripts does the same thing so under what condition do we use [[ and ~. 1. x="abc" y="abc" [[ $x =~ $y ]] ...
1
vote
1answer
118 views

Automate setup of keyboard shortcuts in KDE5

Can the configuration of keybindings in KDE be scripted? I know the shortcuts are probably stored somewhere in ~./config, but the files doesn't appear to be in a stable or easily scriptable format. So ...
0
votes
0answers
10 views

Reloading tab completion in postinst script

I'm distributing a .deb that (among other things) installs a file to /etc/bash_completion.d/example for tab completion. The file gets installed correctly, but the tab completion is not immediately ...
1
vote
1answer
82 views

No such file or directory

Running this command on the server: mongorestore -c basic --drop -v --db my_db -u user -p pass dump/basic.bson Works perfectly fine. But when I put this single line in a script (sh) file: Failed: ...
-1
votes
4answers
88 views

With KSH, how to convert “12345” to “1.2.3.4.5?”

With KSH, if I have a string 12345 and I want to it be converted to 1.2.3.4.5, how can I do that? I tried to use cut but it's not straightforward. echo "12345" | cut -c1
1
vote
2answers
87 views

Unable to validate date format in shell script

I am trying to give a user 3 chances to type in correct date format which is mm/dd/yy. If all the 3 times he puts in wrong date format the code will display "Invalid date" and if once out of the 3 ...
0
votes
0answers
52 views

Linux: Delete all but x files?

I have a series of files with different IDs: File_ID1_1 File_ID1_2 File_ID1_3 File_ID1_4 File_ID1_5 File_ID1_6 File_ID2_1 File_ID2_2 File_ID3_1 File_ID3_2 File_ID3_3 For every ID there is a defined ...