Tagged Questions
2
votes
2answers
77 views
Quick and dirty way to run a process more than once
I am looking for very simple bash script that would allow me to launch a process a few times. What's essential to me is that after the processes terminate, everything will clean up automatically.
...
-5
votes
0answers
39 views
how can I make a program that detects and displays errors occurred in initializing of an Unix system?
program that detects and displays errors occured in initializing of Unix system
8
votes
7answers
2k views
Using xargs with input from a file
Say I have a file with the following
bob
john
sue
Now these directly corrospond to (in this case) URL pattern such as http://example.com/persons/bob.tar, john.tar, sue.tar.
I would like to take ...
-4
votes
2answers
116 views
How to write bash script that deletes the oldest file in a directory if there are greater than N files in the directory?
Wondering how would one go about writing a script that:
Counts the number of files in a directory.
If that number is greater than a specified number N, delete the oldest file in the directory.
For ...
0
votes
1answer
152 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 ...
3
votes
2answers
50 views
How to add a line to a file which has only root write permission and to continue the script execution
I am trying to learn bash scripting. I am working on a practical problem and at one point I need to add a line to a file which requires root permission to write.
The code looks like this:
# some ...
2
votes
1answer
27 views
How do I detect whether changes in nano were discarded or saved?
I am currently writing a small setup script for a Linux application that needs the user to edit a configuration file before the application is started. I've chosen to make the script simply open the ...
-1
votes
0answers
69 views
Bash getopts and passing parameters
I am trying to use getopts and assign different outcomes when a flag is passed. What I am doing is passing a -f flag and what I want to happen is the outcome either puts the command on stdout ready ...
2
votes
1answer
97 views
Is there a shell utility for printing the contents of a plist? Preferably for a jailbroken iOS device?
I need a tool that prints the actual text in a plist file (plutil changes the format, cat prints gibberish, and there is no defaults command for iOS). It needs to be in a script, so text editors don't ...
3
votes
3answers
95 views
using stat to provide timestamp for touch
Am trying to OCR some documents insitu (from a linux command line on a windows share). The process of OCRing is find and I have muddled through using the find command to pipe the files through the ...
4
votes
3answers
208 views
What does the following Bash script mean/do?
What does the following script mean?
exec 4<&0 0</etc/XX/cfg
read line1
exec 0<&4
UPDATE
Thanks for the answer, just one part I'm not sure:
It redirects fd0 to fd4, and ...
3
votes
2answers
115 views
How can I force a bash loop to end if it runs x times in x seconds?
I'm trying to grab batches of input from a remote pipe via ssh. My script below works ok, but I would like to add some sort of check into it so that if something were to go wrong or break the loop ...
1
vote
1answer
143 views
Run expect inside a bash script as another user
I am writing a bash script to install some small software I'm developing. That script is run with sudo (as root), but some of the commands that are executed by the script need (or should be) run with ...
4
votes
6answers
250 views
Linux script or program to shorten filenames
I haven't had much success in finding a Linux version of namemangler, which I need to rename 1000 of files so they are readable on Windows.
Does anyone know of a Linux program that can do this?
If ...
2
votes
3answers
86 views
Converting a history to a script?
Often times I've typed in a bunch of commands when I realize that I am going to keep typing them in and that I would really like a script.
Now I understand that no matter how I save my history, I am ...