Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shell-script]

Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.).

5
votes
0answers
229 views

Get notified from avahi

After looking for a zero-conf browser valid implementation I realised that inside my linux machine (ubuntu) I already have avahi and typing: avahi-browse -alr I get a complete list of all devices ...
4
votes
0answers
305 views

Understanding line numbers reported when using eval

Okay, so I'm stuck working with a shell script that needs to use eval (I know, I know, ultimate evil etc…) however I'm having difficulty debugging some of the line numbers being thrown out by errors. ...
3
votes
0answers
54 views

Git - prune every whitespace-separated word originally introduced by specific author in project's history

We have a project under git revision control with only a single branch. We need to remove every new whitespace-separated word that was introduced for the first ever time in a given file by a specific ...
3
votes
0answers
434 views

Restore backup of $HOME via rsync

I'm using Opensuse Leap 42.2 and use zypper as my preferred package manager. I did regular incremental updates of my home directory to an external drive via the script: #!/bin/bash source="/home/...
3
votes
0answers
644 views

xdotool prints 8 instead of Tab

I'm currently working on a "autotype"-script for pass. In oder to do that, I need to type the username, press 'Tab' and then type the password. For testing I'm using the following code: WID=$(...
3
votes
0answers
211 views

Shell script to unlock gnome-keyring for school internet upon login

My school's wifi network is not protected merely with a WPA/WPA2 password, it requires authentication (PEAP, MSCHAPv2). I can log into it fine (the credentials are in my network connections) however ...
3
votes
0answers
299 views

How to use `gnome-terminal` with new client/server architecture as wrapper?

Anyone knows how to accommodate for new gnome-terminal-server magic? Before gnome-terminal got its new "client/server" architecture I used to use it as vim wrapper with great success for many years. ...
3
votes
0answers
219 views

unbuffer/expect swallows the rcode when its child is signaled

unbuffer is able to pass along the return code of a process under normal circumstance, but if the process you are unbuffering is killed, for instance with a segfault, I see $? as 0 while I expect 139. ...
2
votes
0answers
49 views

Copying contents of a folder via SCP results in `scp: error: unexpected filename: .`

I was using a script to copy the contents of a folder via SCP, without copying the folder itself. Something like this: scp -i id_rsa -P "$PORT" -r "$HOST:/folder1/folder2/." "backup" (I'm not able ...
2
votes
0answers
39 views

PAM configuration to execute a shell script on every login failure

I would like to execute my shell script on every login failure. To do this I updated the file /etc/pam.d/common-auth: From (original body): auth required pam_env.so auth required ...
2
votes
0answers
33 views

Run Command When IO Load Average is Low?

I have a bash script which calls an external program I cannot modify. The first stage of this program uses high IO and the second stage uses almost no IO, instead it uses a lot of CPU, it does not ...
2
votes
0answers
36 views

How to trigger a command after named pipe closes?

How can I execute some command after the named pipe has been readout in other end. I was trying to use trap. But nothing happens. My script is something like below. #!/bin/sh cleanup() { echo "...
2
votes
0answers
41 views

Debian wvdial parse result to auto set the IP address

I'm trying to get wvdial to work automatically with a Telit LE910 WCDMA modem. My script will start up the connection as needed, then disconnect when not needed to prevent wasted data. One of the ...
2
votes
0answers
38 views

Get the path of song playing in VLC using python script

I am trying to get the path of song playing in VLC using python script. I have already find out the Process ID of vlc using pgrep -x vlc And I can also display the all file descriptors of vlc ...
2
votes
0answers
52 views

Execute script on external keyboard connection

EDIT: This is NOT a duplicate because the linked question is about external USB drives, not keyboards. The suggested command udevadm info -a -n sdb does nothing in helping to find the corresponding ...
2
votes
0answers
158 views

How to run gsettings or “nohup nm-applet &” as normal user in a script started with sudo?

I wrote some scripts that have commands such as: gsettings ... nohup nm-applet & Both commands showed feedback when running the script without sudo (as normal user). When I started the script ...
2
votes
0answers
86 views

How to find out which process is deleting a file without root permissions?

I am manually running a program in a cluster by copying the executable file to each node, running it and them copying back the output to the server node. Suddenly, I noticed that a file that takes ...
2
votes
0answers
56 views

Stop a process when another process starts

I was setting up Bumblee with primus to switch between my discrete/integrated GPUs using the Arch Wiki as a guide when I saw this: Note: Since compositing hurts performance, invoking primus when a ...
2
votes
0answers
77 views

Show colors from child shell in parent shell

I solved this once, but I cannot remember how I did! In my child process, I have this: echo -e "some control chars" In my parent process, it will show the plain string, without any terminal styling....
2
votes
0answers
223 views

Is there jitsi SIP-client for Ubuntu or Debian which has command-line interface?

Is there jitsi SIP-client for Ubuntu or Debian which has command-line interface? So, for example, I can make calls without using jitsi GUI, just sending commands to the application.
2
votes
0answers
315 views

Background task in bash script

I'm trying to write a "while true" bash script that responds to events. (It's a webhook for git push notifications, but that's not very relevant at this point.) I could block, waiting for the next ...
2
votes
0answers
69 views

Copying Large files - does it create an empty file in the destination?

I have a filewatcher script which notifies when a file is missing or it is empty. The files that I'm expecting - some of them are big. The files are copied by another script/job from a different path (...
2
votes
0answers
166 views

Sending a script to tty instead of vt (specific problem stated, other solutions welcome)

I am curious as to what is the simplest way of sending an executed command (in this case, a bash script), that had been executed in a terminal emulator into a tty. Context: I am sick and tired of the ...
2
votes
0answers
227 views

shell script approach to restart different services on different machines

I am trying to write a script to restart different services on different machines. Before that, I wanted to check with you guys if anyone has any better suggestions. Usually, we connect to different ...
2
votes
0answers
121 views

Merging two files after checking that some of the columns match

Let's assume that I have two files 912300001.file1.txt and file2.txt and they contain the following: 912300001.file1.txt VALUE 1000 -21 -21 VALUE 1001 -23 -22 VALUE 1002 -23 -21 ...
2
votes
0answers
237 views

Automatically running an installation cli script in terminal on startup

I created a custom Arch distro iso with Archiso and I wrote an installation script that prompts the user for input for install options. So far, the installation process is: boot the arch iso execute ...
2
votes
0answers
133 views

How to explicitly set the tabname of a new gnome-terminal?

I want to explicity rename a tab in gnome-terminal on startup of the tab. I don't want to use gnome-terminal --title flag as that gets reset by my systems bashrc file after whatever else is supposed ...
2
votes
0answers
653 views

How to time the execution of parallel commands

I am trying to write a bash script that launches n commands in the background and then waits for each command to finish. I can easily get the time it took to execute all the commands using time sh ...
2
votes
0answers
127 views

Rollback misconfigured network settings in systemd using etckeeper?

I was thinking how to automatically rollback network misconfigurations with etckeeper and systemd. Workflow: # etckeeper commit # $EDITOR /etc/systemd/network/wired.network # systemctl restart ...
2
votes
0answers
156 views

How to clean or overwrite RAM and shut down computer by bash script that reacts on keyboard shortcut?

My system is protected by Full Disk Encryption. The weak point of my computer is RAM which lives a bit after computer is off, containing some important safety information I would like to clean up. ...
2
votes
0answers
76 views

executing shell script from launcher, slow to end/complete the script

I am using a bash script to rotate my screen via xrandr. To make it easier to use I added the script to the unity launcher. The problem I have encountered with this is that the script seems to ...
2
votes
0answers
291 views

Avoid starvation using flock with 2 process with write and read lock

I have two scripts let's call them script1 and script2. The script1 is scheduled every 2 minutes and it takes 4 minutes to execute the script2 is scheduled every 30 minutes and it takes 4 minutes to ...
2
votes
0answers
122 views

Shell script which runs mono_service.exe as a background task

When I start an Ubuntu Linux 16.04 process with /usr/lib/4.5/mono_service.exe AudioRecorder.exe it returns right way. But, when I write a bash shell script with one line: exec /usr/lib/4.5/...
2
votes
0answers
93 views

pmap hangs on OOM process

I did attempt a search, but there doesn't appear to be much out there on pmap so here goes. I have a script that works with WebLogic instances to gather data on them which we can send to our Devs for ...
2
votes
0answers
80 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 ...
2
votes
0answers
284 views

i3status script that change its text by itself

I am trying to add a block for rss the latest news in my status bar. The news is composed by a title and a description. The full text doesn't fit in the status bar, so I would like to make it read ...
2
votes
0answers
1k views

How do I convert the complete AMD64 Gentoo Handbook into a PDF from the command-line?

I have been writing shell scripts for converting the AMD64 Handbook of Gentoo Linux to PDF and this is my current shell script: function ghand { # Input 1 is the architecture # Input 2 is the ...
2
votes
0answers
644 views

Slow script execution

I have a strange problem... My script: #!/bin/bash SECONDS=0 lock_file=/tmp/$0.lock [ -e $lock_file ] && exit touch $lock_file echo "<<<db2_hadr_check>>>" instances=( ...
2
votes
0answers
57 views

APCUPSD script can't close program

I want to use APCUPSD to stop a program (called ns_image_server) which runs in a terminal window when it detects that power has been lost, to give that program time to close before the computer shuts ...
2
votes
0answers
170 views

“login -qf” as root results in “Login incorrect” error

I'm trying to install pow on an OS X machine.* Some of pow's components have to run as root, so part of the setup process involves running an installation script with sudo. The problem is, this setup ...
2
votes
0answers
630 views

Udev running hibernation script

I have this udev rule that launches a script when the battery level is 5% or below: $ cat /etc/udev/rules.d/90-lowbat.rules: SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="...
2
votes
0answers
375 views

background gui process in shell script

In the below script, ivfstudio commands open a gui. Even launched as a background process, I need to close it first so that the next commands are executed. How to make it "really background" ? #!/bin/...
2
votes
0answers
510 views

Trap not trapping SIGTSTP

I have a script that keeps displaying the login prompt: #!/bin/bash trap '' 2 20 while true; do login done This is part of a bigger project so please don't tell me to just use the system login ...
2
votes
0answers
259 views

Shell scripts for the database logs

The actual log file will be like this $ cat file1.log time=2014-07-23 23:56:28 GMT, user=[unknown], db=[unknown], host= pid=28254 LOG: time=2014-07-23 23:56:28 GMT, user=portalman, db=ss, host=172....
2
votes
0answers
130 views

Scripts cannot run simultaneously on startup

I want two scripts (Server_drive, Server_video_boot) running on startup, but there is conflict between them. Specifically, there is always running the script with the lower priority. I tried with many ...
2
votes
0answers
371 views

Check via Shell-script if server currently streams via dlna

Currently I'm running uShare to stream videos from my home-server via DLNA to the TV. On the server there is also running a bash-script which checks if a user is connected via ssh or Samba. If this is ...
2
votes
0answers
4k views

Script stops command in it with exit 0

When I write a bash script similar to this on RHEL 6, if [ "$2" = "" ] ; then echo vip.start: ERROR: no NIC specified echo vip.start: Need IP and base interface name exit 1 fi case "$1" ...
2
votes
0answers
181 views

how to list blocked connections events by the firewall?

So, I used firestarter that had logged blocked connections events with some useful details (but it is not being updated and I found somewhat unsafe as any moment we could click to deactivate the ...
2
votes
0answers
7k views

Using sshpass, return code (exit status) differs for reasons unknown using valid commands

There are a few things going on here but I think ultimately, either CLish or SSH is returning an exit code that is messing up my work flow. I'm attempting to connect to a remote machine (CLish shell) ...
1
vote
0answers
46 views

How to use the stdin as a file

I have a command that wants a file as input, but I get the input from the stdin and I don't want to create a temporary file. I would like to do the following: #!/bin/bash osadecompile /dev/stdin <...