getting pid of the background job using “$!”
I’ve a written a shell script to launch multiple background jobs and store the process id’s of them in an array using $!
. In the end I print all the process id’s by iterating through the array. I want to know is the shell script written has a bug? And, the reason I feel there is a bug in my shell script is because $!
might return the process id of another process if in case there are multiple processes being created in my PC.
Why doesn’t this xargs and mv command work?
I want to mv
the latest file to the specified directory.
Why doesn’t work this xargs and mv coomands?
I want to mv the latest file to specified directory path.
Check if instance/daemon is running
I want a program to tell me if it is already running, if I try to start at, while it’s active.
Fx. in the terminal, I can get the status of a daemon by doing: sudo /etc/init.d/myDaemon status
User Configuration of a Shell Script. Best practices?
I am writing a shell script with a few variables that should be configured by the user. There will be an installer for downloading and configuring the script, possibly by asking a series of question. The script in question is aimed at other developers.
Difference between a REPL and interactive shell
Noob question. I am not quite able to tell the difference between a REPL and an interactive shell just by reading the definitions on Wikipedia.
Is it a bad practice to write shell script with many if-else statment and for loops?
I am maintaing several data process shell scripts which are full of if-else statements and for loops . I try to make the scritps tidy and easy to debug.
DB API for shell scripting (any shell)
I am faced with some legacy shell scripts that run batch data processing jobs in Oracle using SQL+
. For the most part, the data tier does not have to communicate back to the script with retrieved data to be passed for shell-level processing but in a few cases it does.
Which language is more suitable heavy file tasks?
I need to write a script (based on basic functions) to process /image/audio/video files. The process is mainly filesystem tasks and converts. The database of files has been stored by mysql. The script is simple but cause heavy tasks on the system; for example renaming/converting/copying thousands of file in a run. The script does not read the content of files into memory, it just manage the commands for sub-processes. The main weight is on the communication with filesystem. The script will be used regularly for new files. My concern is about performance. I am thinking of
Is it possible to use python as a shell replacement? [duplicate]
This question already has answers here: What’s shell script’s advantage over interpreted programming languages? [closed] (8 answers) Closed 11 years ago. Recently I was looking at python’s shutil and subprocess etc… And I started wondering: wouldn’t it be ok to use python instead of e.g. bash? What am I missing? python shell bash 2 Convenience […]