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

learn more… | top users | synonyms (2)

4
votes
0answers
189 views

How to write a shell script to run multiple command in different screen sessions?

My goal is to write a zsh script in order to create multiple screen sessions and run separate commands on each of them. I would also like to check at the beginning of my script if there are any ...
3
votes
0answers
29 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 ...
3
votes
0answers
131 views

Securing a script a little more

I currently have the following script which works fine: #!/bin/sh user="$(zenity --entry --title="Username" --text="Username")" pass="$(zenity --password --title="Password" --text="Password")" ...
3
votes
0answers
98 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. ...
2
votes
0answers
20 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
55 views

Copy folders at once

I want to copy a large number of folders at once not one by one. Is it correct to use the following code ? Is it helping to run the command cp for all the folders i at once? #!/bin/bash foreach i in ...
2
votes
0answers
82 views

Write the same file multiple times to one file using dd

I am trying to create large dummy files on a drive using dd. I am currently doing this: #!/bin/bash writeFile(){ #$1 - destination directory/filename, $2 - source filepath $3 - blocksize, $4 - ...
2
votes
0answers
25 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
63 views

When gnu parallel exit,my program also fail

I use gnu parallel to run a bash function. The function just contains the bash script to restart my program. At first, the restart is ok, but when the gnu parallel script exits, my program also fails. ...
2
votes
0answers
54 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" ? ...
2
votes
0answers
600 views

Running shell script inside with vagrant provision

I have setup a vagrant box using precise64 (ubuntu 14.04) and installed packages needed for octopress. I can ssh into the vagrant box and generate posts and run preview for my octopress site. Now I ...
2
votes
0answers
79 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, ...
2
votes
0answers
53 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
777 views

Creating multicast join for tcpdump captures

I want to write a linux shell script which will capture specific multicast traffic. Specific as in, I want to create a pcap file that has all the traffic for one specific multicast group/port. Here ...
2
votes
0answers
137 views

Why is my inotifywait loop exiting after removing some subdirectories?

i have the following bash script: #!/bin/sh dir1=/source/dir/path/ while inotifywait -qqre modify "$dir1"; do rm -r /destination/dir/path find /source/dir/path/ -name .svn -exec rm -rf '{}' \; ...
2
votes
0answers
418 views

Number comparisons in BusyBox ash

I have the following script that extracts data from the EXIF command on my BusyBox ash-based system. I parse the date tag from the end of the file and use case as a final check to ensure the format ...
2
votes
0answers
152 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
1k 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
442 views

Validate Password for user account from shell script

Application is for a multiple server standardization script Looking for a way in a shell script to check if the password for an OS account (AIX) matches a standardized plain text password. The ...
1
vote
0answers
33 views

Script for “battery level reminder”

I want to plug in the laptop battery charger when the battery level goes down to 40% and then plug it out when the battery charge level reaches 80%. And for that reason, I need a script that would ...
1
vote
0answers
15 views

Pass/Firefox master key integration?

I handle my passwords with pass, and I use the Firefox master password functionality. The master password is rather long and "safe" and stored in pass along with the others. For now, my usual Firefox ...
1
vote
0answers
16 views

remote control of vlc using script over ssh

I'm trying to control vlc video playback on a remote machine using a script and remote ssh. I have machine A, which logs into machine B with this command: # sshpass -p <password> ssh ...
1
vote
0answers
34 views

Add entries to an array inside a loop

I am trying to update an array in a linux tcsh script. The script uses a while loop, and I want to add elements to the array every time the loop iterates. Is there a better way to do this? ...
1
vote
0answers
35 views

trash and restore script - issue restoring

#!/bin/bash echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" read ans case "$ans" in Yes) echo "$(readlink -f $1)" >> "$HOME/TrashLog" && mv "$1" ...
1
vote
0answers
47 views

Cron can't access my home directory when I'm logged out

I have quite a strange problem using cron. I distilled it thus far: I created following simple bash script in /home/user1/cron_dir/cron.sh: #!/bin/bash echo "Success" As user1 I created following ...
1
vote
0answers
37 views

How to select an option from a select menu from a script?

I'm working on a script to automate a fill tasks that I do hundreds of times a day, such as building iOS/Android projects, but I'm not very experienced with shell scripting. In one of the projects, ...
1
vote
0answers
26 views

Start glassfish in LINUX server remotely

I want to start glassfish on a server running LINUX, the problem is that my service provider does not grant access to ssh connections nor any other helpful tool to run asadmin start-domain I have ...
1
vote
0answers
78 views

Cannot add startup service to openWRT from init.d

I have openWrt installed on a TP-Link TL-WA901N/ND v3. I don't have luci package installed because I don't have enough space, so I can only do thing via cli. What I'm trying to achieve is to create a ...
1
vote
0answers
44 views

Need a script to send an email when an input has not changed for more that 30 minutes

I need a linux scrip that will send an sms when there is an input change and it has not gone to the initial state after 30 minutes, I have the following so far, but, I am sure there are few things ...
1
vote
0answers
63 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", ...
1
vote
0answers
34 views

Get path of currently marked file

Im running OS X and I'm wondering if there is a way to get the path of the currently marked file in Finder. Like, can UNIX determine what file i have clicked on? Reasons for this would be for ...
1
vote
0answers
18 views

Submitting a script to TORQUE `qsub`: PBS lines before or after shebang line?

I am submitting a script to a cluster that uses TORQUE. Should I add the #PBS lines before or after the shebang line?
1
vote
0answers
177 views

extracting data from a log file and plotting it using Gnuplot

I have a logfile with the following data in it: Sat Sep 20 11:25:01 BST 2014 -- temp=53.0'C -- message from script /usr/src/scripts/wifi_test_2.sh Sat Sep 20 11:26:01 BST 2014 -- temp=53.0'C -- ...
1
vote
0answers
54 views

tput command + how to locate dialog window on the top of the screen

Is it possible to use the tput command in order to place the dialog window on the top of the screen ? For example The following dialog command display the log is running by tail command dialog ...
1
vote
0answers
54 views

Setting XDG_DATA_HOME and XDG_CONFIG_HOME on compile/per program

The goal is to have a -dev version and a stable repository-based version installed at the same time, but with different data and config directories so that the dev version is not operating on(and ...
1
vote
0answers
37 views

Verbose output in logfile and simple output on screen?

Let's say I have the following script: script.sh and i want the verbose output in a logfile and simple output on screen. Logfile should contain the csh -v script.sh output, and on the screen should ...
1
vote
0answers
84 views

script started in .xinitrc stays in processes

I have made a little startup bash-script to run before my wm starts. Unfortunately after X and WM is started this script is still listed in the in htop and I don't have a clue why... this is the ...
1
vote
0answers
69 views

Bash script for opening screens and compiling the same file

I have written a bash script to initiate separate screen sessions and run a command in each of them that compiles the same C++ source file in ROOT (an object-oriented data analysis framework ...
1
vote
0answers
51 views

Run startx & automatically embedded syste,

I am working with a board in which I run my application which use th graphical mode. Everything works perfect. I start the graphical mode like this: startx & and then I run my application like ...
1
vote
0answers
164 views

How to properly start and stop shell script in linux, busybox?

I am trying to write a small shell script that would send some commands to my tv set from my set top box that has busybox on it. The problem is that it generates huge amount of zombie processes, and ...
1
vote
0answers
85 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 ...
1
vote
0answers
26 views

FFMPEG stream won't show up on Justin.tv

INRES="1366x768" # input resolution OUTRES="1366x768" # Output resolution FPS="35" ...
1
vote
0answers
37 views

Open to specific gvim tabs

I have a working environment that I'd like to save via a script. -EDIT: I don't need to save it's state, I just want my script to define it. Though saving state would work too I guess. Currently it ...
1
vote
0answers
144 views

Changing KDE's mouse theme and buttons settings from a shell script

I'm trying left handed mousing, and I want to be able to easily switch between right handed mode and left handed mode. There is a utility for Windows called SwapMouseButtons that allows to bind a key ...
1
vote
0answers
84 views

Cron job running but not establishing tunnel

I have a script which establishes a reverse tunnel on an endpoint HostB. It looks like this: cat tun.sh #!/usr/bin/env bash # Test code /usr/bin/ssh -V 1> /home/userA/bin/tun.stdout 2> ...
1
vote
0answers
69 views

Execute commands on TMUX Detach

Is it possible to execute commands on tmux detach? I usually have a rails console and server running in the tmux session, on detach is it possible to automatically end those? Thanks.
1
vote
0answers
69 views

Running a script after tty1 has loaded

I have been attempting to write a script to run dcled on start up, the program that runs this. I am using Debian Jessie with multiarch enabled. This is essentially a small file server. I am ...
1
vote
0answers
71 views

Better approach to generating and adding contents to files

I have an input file like below. 1 First one 2 First two 3 First three 3 Second three I am generating 2 output files like below. #FILE1 1 First one 2 First two 3 First three #FILE2 1 ...
1
vote
0answers
50 views

manipulate a Drush “internal” variable

I want to modify a variable (preferably in a Bash Script format) because my PHP environment requires a port number. To show a URL in Drush containing a token that logs you in as user 1 (without a ...
1
vote
0answers
44 views

List Mails by subject

I'm writing a script to send mails from a mailbox on a remote server and a script to check if the mails are received at another remote server. For this I have configured mutt. What I now need is to ...