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

learn more… | top users | synonyms (1)

5
votes
1answer
1k views

Global /etc/profile setenv or export overwriting user settings in .profile

I need to call a modified version of a program in /home/user_name/bin rather than the (older) version in /opt/program_name/current on a CentOS 5.3 cluster. The program creates a tcsh script using ...
3
votes
1answer
422 views

Noninteractive script running over ssh is interrupted as apt-get finishes

When I run the following non interactive script on Ubuntu Server 13.04 it's interrupted when lxc-docker package finishes installation. Script : ssh -o StrictHostKeychecking=no -t -t -i $CERT ...
2
votes
1answer
30 views

gnome-open execute shell script

Is there a way to execute shell scripts automatically using gnome-open? If I call gnome-open script.sh in the terminal, the script opens in the default text editor. However the shell-script is ...
2
votes
1answer
161 views

How to strip color codes out of stdout and pipe to file and stdout

I have a program that uses printf with some tput mixed in it and I'd like to pipe the output to stdout as well as a file. I'd prefer to use sed since I don't want any unnecessary dependencies on my ...
2
votes
1answer
129 views

Merging folders with practically the same name but different casing

When digging around in the advanced settings in Dropbox I lost a folder. I only discovered this about a month later. I managed to get this folder back from Dropbox however the file structure of the ...
2
votes
1answer
83 views

exec cp failes from script, yet works when issued directly

I have a script that copies SQL backups to a windows server. Here's the line from /etc/fstab: //my.win.box/share$ /winshare cifs ...
2
votes
1answer
335 views

KSH styling text based menu using STDERR

Is it possible to format the STDERR in order to have a better looking menu using the select command? I have a simple select select oChoice in $(<tempMenu.menu) ; do case "$oChoice" in ...
1
vote
1answer
36 views

Automatically copy PDF.plugin to Chromium.app

I'm using Chromatic.app to update my Chromium.app recently. I'd like to use Chrome.app's PDF.plugin in Chromium.app. Therefore I need to copy PDF.plugin to the following directory: ...
1
vote
1answer
142 views

How do I start smbclient from a script in Linux?

I want to be able to quickly start smbclient to a specific directory without typing or copying it to the shell command line, but just sticking it in a script doesn't seem to work... #!/bin/csh ...
1
vote
1answer
164 views

get free string genre id3-tag and not only genre number in bash script

I'd like to read the id3-genre tag within a bash script. I tried id3tool, eyeD3, etc -- but these tools just support the genre number. How to get the free string genre tag? My music players (Amarok, ...
1
vote
1answer
473 views

Deleting Non-empty Directory with smbclient

How can I remove a non-empty directory with smbclient? I have tried the following: 1) rm Result: NT_STATUS_NO_SUCH_FILE listing [dir_path] 2) recurse;rm Result: No Error but also nothing ...
1
vote
1answer
416 views

Command/scripts to check the Reverse DNS Lookup time

I am working on a project in which one master communicates with numbers of slaves. For that it has to make connection with hosts in network. But sometimes it hangs. I think that the reason behind is ...
1
vote
1answer
281 views

Can I get the backup option of cp and mv to work with directories?

--backup[=CONTROL] make a backup of each existing destination file The man page does say that it works on file. It doesn't seem to have any effect on directories. Is there anyway to make this ...
1
vote
1answer
428 views

Script that unpacks a initrd, allows editing of the preseed.cfg and the packs it to cpio and gzip again

I want to program a script that allows what is said in the title. So basically I gunzip the initrd, than unpack the cpio, open vi to allow editing, save, pack with cpio, and gzip again, so nothing ...
0
votes
1answer
10 views

insert value at the end of every record based on unique IDs

I have 2 files , one with Delimited and other one is Positional file. These two files shares same unique ID's as shown below but both the files contains different information. del.txt ...
0
votes
1answer
23 views

How to track SFTP's error

I have 1 script which is used for SFTP. I am getting error for permission issue on target server. I want to track this error in log file. How i can track the sftp's error. below is my code, sftp ...
0
votes
1answer
74 views

Run smartctl on all disks of a server [Solved]

My question is a quite simple , I want to run the command smartctl -i -A on all disks that the server have. Think that I've too much server with different number of disks and RAID Controllers, then I ...
0
votes
1answer
237 views

“Expect” automation tool output to shell variable

#!/bin/bash # more commands here expect << EOD spawn telnet localhost 9151 expect -exact "Trying 127.0.0.1...\r Connected to localhost.\r Escape character is '^]'.\r" send -- "AUTHENTICATE ...
0
votes
1answer
147 views

need to display hard error , transport error & soft errors above 2

iostat -En | nawk '/Hard Errors/ {line=$0;gsub(/.*Hard Errors:/,""); \ if($1>2) printf("%s\n",line); }' The output of this is c0t1d0 Soft Errors: 0 ...
0
votes
1answer
816 views

Why does scp say “No such file”?

I have a bash script that uses scp to copy a file from my machine to another. The script keeps on exiting after I enter the SSH password with the error: <filename>: No such file or directory ...
0
votes
1answer
267 views

Starting Resque worker with script doesnt work, starting by hand does

I am trying to figure out why my process doesn't work if started via a script, but works fine if started by hand. Here's the details: script is a resque worker start script. The script location is ...
0
votes
1answer
100 views

Package Installation log creation

I have written a script for installing packages on Linux(Ubuntu). So I want to create a log file for installation of packages for troubleshooting if any problem occur during installation.So please ...
3
votes
0answers
60 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
80 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
108 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
349 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
17 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
24 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
54 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
38 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 ...
1
vote
0answers
132 views

Shell script to backup VMware VM's, exporting each VM to a list then asking user intput

What I'm Trying To Accomplish: Get list of Virtual Machines ".vmx" file and place in variables Give the user and choice of which VM to backup Use "ovftool" to produce an export of the chosen VM to ...
1
vote
0answers
80 views

Intercepting packets with bash

I'm wondering if it's possible to detect a packet that comes from certain IP and port(suppose IP 1.1.1.1 and port 80) and has some specific information on it (suppose "<h1>Web ...
1
vote
0answers
57 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 ...
1
vote
0answers
1k 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
164 views

how to create a script to backup MySQL databases on separate files?

I need to create a script so to automate the backup process for my database server. Today there are 19 databases on the server and to prevent some schema is created and not contemplated by the script, ...
1
vote
0answers
530 views

rc.local not being executed when os boots up

I have a script that needs to be run when os boots up. I added it to /etc/rc.local. It was working fine for sometime but now rc.local does not load at boot time. When i checked the permissions on the ...
1
vote
0answers
81 views

How to make tcsh not insert whitespace in a command that spans multiple lines

Bash does not seem to insert whitespace but tcsh does. Tcsh bash-3.2.25$ tcsh -c 'echo $tcsh; echo A\ > B' 6.14.00 A B Bash bash-3.2.25$ bash -c 'echo A\ > B' AB How can I ask tcsh to not insert ...
0
votes
0answers
22 views

How to find the currently running app from terminal on OS X?

I'm writing a shell script runs in the background and monitors user activity. I'd like to be able to capture current application/document if possible. Can I do that? (Cross-posting this from ...
0
votes
0answers
48 views

bash script to check zabbix java gateway

I wrote simple script to check status of a service and when service is down search live processes for the service and kill them, then remove pid file and restart service. The problem is that the ...
0
votes
0answers
31 views

How to install libevent tmux?

I've been trying to install libevent / ncurses / tmux into '$HOME/local', but am having an issue running .configure for tmux. What I am trying to do is install it as follows: TMUX_VERSION=1.8 ...
0
votes
0answers
32 views

Shell script use ssh forwarding to send a file to a second system

I have ssh forwarding enabled and ssh to server A. On server A I want to run a script as root and take advantage of the ssh key being forwarded for USER to send a file to system B. I'm getting a ...
0
votes
0answers
31 views

Is there a difference between `command rspec` and `rspec`?

I want to call bundle exec rspec if Gemfile exists in current directory, and if it doesn't exists, call rspec itself. So I wrote like this. function rspec() { if [ -e 'Gemfile' ]; then echo ...
0
votes
0answers
79 views

Shell Script : Check for all the source files in different paths

This is the naming convention of the file. <yearmonthdate>_<sourcesystem>_<totalnoofpartsof file>_<subject area>_<part number>.dat (or .dat.gz) First part is Date, ...
0
votes
0answers
20 views

file system is not mounted on system: warning crnonshdw not mounted on system

I am new to this field scripting. I am a Solaris engineer. In my system when I type: df -k it will output it like this: mmr1ap04:/xahome/xa21> df -k Filesystem kbytes used avail ...
0
votes
0answers
322 views

LFTP mirror upload only non existing files to remote directory

Every 5 minutes some new files are downloaded via lftp to a local directory. I need to upload to another ftp only the non existing files. My script so far is: #! /bin/bash today=$(date +%Y%m%d) ...
0
votes
0answers
45 views

When adding a ip via ifcfg how do you have it auto increment the clonenum?

I'm writing a script that adds ips to a multihomed machine. I'm not allowed to use network-scripts folder because well that's what they said. They also stated they wanted to clone num to increase. ...
0
votes
0answers
206 views

Error sending message, child exited 71 (Operating system error)

I'm trying to send mail through mutt command. I got the error message Error sending message, child exited 71 (Operating system error.). I was able to send email through this command earlier, but ...
0
votes
0answers
496 views

IBM V7000 scripts for monitoring

Hello (I'm no hard core coder:), I try to develop a script to do some very basic monitoring on an IBM SVC. My goal is to get some information about the nodes and my quroum status and then send ...
0
votes
0answers
2k views

bad magic number

I have a script which I need to execute. The script file is push.sh. Below are the commands that I am using: dragan@dragan-Lenovo-G570:~/liquibase/liquibase$ chmod +x push.sh ...
-5
votes
0answers
15 views

How to find out file count validation in UNIX

ThE SCENERIO IS I HAVE TO SFTP 3 FILES EVERY MONTH NOW.IF COUNT OF FILE READ IS LESS THEN 3 I WILL NOT SFTP THE FILES.PLEASE SUGGEST THE WAYS TI DO IT.