Bash scripting is making scripts in the Bash shell language.

learn more… | top users | synonyms

2
votes
4answers
2k views

BASH - grep - works on command line, but not script

I am trying to get the number of occurrences in a script and when running the command on the command line, it works fine, but not in a script. Both variables are initialized. FILE_PATH is the ...
1
vote
1answer
261 views

How to script for a graceful program 'quit' as 'kill' leaves a mess behind

On PClinuxOS 2010 I use SMB4K to manage LAN shares. It works perfectly, unless I forget to quit SMB4K before shutting down the computer. If I forget, AND a mounted network share has gone offline, the ...
0
votes
1answer
3k views

start-stop-daemon works at command line but doesn't work in /etc/init.d script

I'm trying to get a starter script (for a ruby gem called ar_sendmail) working in /etc/init.d/ar_sendmail: #! /bin/sh echo "in /etc/init.d/ar_sendmail" DIR=/home/max/work/e_learning_resource/trunk ...
0
votes
2answers
197 views

Awk script usage

where should the awk program command file be placed when I am trying to run the awk command inside a shell script? I guess it should be in the same directory, but not sure. Please help.
0
votes
1answer
5k views

Why can't I delete a file with a bash script

This may be a silly question, but I can't seem to run rm from a bash script and remove a file. #!/bin/bash rm -rf myjunk.out exit 0; doesn't remove myjunk.out
0
votes
1answer
381 views

Execute a command and put the results into a variable… all in a bash script

I'm working on a bash script that backs up a configuration file before copying over a new file. Here's what my snippet looks like: mv ~/myStuff.conf ~/myStuff.conf.bak cp ~/new/myStuff.conf ...
1
vote
1answer
1k views

Shell script to rename multiple files from their parent folders name

I have a file structure like this: 00000010 000000001.file1 000000001.file2 00000020 00000003.file1 00000003.file2 00000003.file3 ... So there are folders with 8-digit names containing one ...
3
votes
3answers
5k views

Process each line of a file in bash

When I want to do something with each line in a file I usually write cat my_file | while read a do gzip "$a" done The gzip is just an example it can be anything. What I'm wondering is if there is ...
2
votes
1answer
4k views

Handle filename with spaces inside Bash-script

In my Bash-script i have to handle filenames with spaces. These are the important lines inside my script: mp3file="/media/d/Music/zz_Hardcore/Sampler/Punk-O-Rama\ Vol.5\ \[MP3PRO\]/01\ -\ Nofx\ -\ ...
0
votes
1answer
2k views

Unable to specify parameters to cvlc in a script

I'm creating a script that issues a few curl commands in order to access a time-protected mms stream link, then set up a relay using cvlc (vlc's command line interface) for my own use on an ...