Testing to see if folder exists is not working as expected in shell script
I am trying to check if a directory exists or not in a user specified input. I have tried using the test -d <path_to_dir>
and then subsequently checking the success of the command with $? -eq 1
. But this does not seem to work as expected.
Testing to see if folder exists is not working as expected in shell script
I am trying to check if a directory exists or not in a user specified input. I have tried using the test -d <path_to_dir>
and then subsequently checking the success of the command with $? -eq 1
. But this does not seem to work as expected.
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.