About 50 results
Open links in new tab
  1. How do I check if a directory exists or not in a Bash shell script?

    What command checks if a directory exists or not within a Bash shell script?

  2. How to check if a process is running via a batch script

    Oct 2, 2008 · How can I check if an application is running from a batch (well cmd) file? I need to not launch another instance if a program is already running. (I can't change the app to make it single …

  3. How do I test if a variable is a number in Bash?

    Apr 30, 2009 · I just can't figure out how do I make sure an argument passed to my script is a number or not. All I want to do is something like this: test *isnumber* $1 && VAR=$1 || echo "need a …

  4. How to check if running as root in a bash script - Stack Overflow

    In addition, with proper use of sudo, you could have the script check and see if it is running as root. If not, have it recall itself via sudo and then run with root permissions. Depending on what the script …

  5. Check if a file exists with a wildcard in a shell script

    Oct 10, 2019 · This looks like a grab bag of "don't do that" shell antipatterns. Don't use ls in scripts, don't check if the word count is zero, watch out for pretzel logic with backticks.

  6. How can I check if a program exists from a Bash script?

    Check if some apt packages are installed with dpkg -s and install them otherwise. See: Check if an apt-get package is installed and then install it if it's not on Linux It was previously mentioned at: How can …

  7. Check existence of input argument in a Bash shell script

    Jun 26, 2011 · I need to check the existence of an input argument. I have the following script if [ "$1" -gt "-1" ] then echo hi fi I get [: : integer expression expected How do I check the input argument1 fi...

  8. How to check if a file exists in a shell script - Stack Overflow

    Oct 17, 2016 · How to check if a file exists in a shell script Asked 9 years, 6 months ago Modified 2 years, 2 months ago Viewed 775k times

  9. Batch script: how to check for admin rights - Stack Overflow

    Oct 29, 2010 · How do I check if the current batch script has admin rights? I know how to make it call itself with runas but not how to check for admin rights. The only solutions I've seen are crude hack …

  10. Powershell script to check if service is started, if not then start it

    The below is a compact script that will check if "running" and attempt start service until the service returns as running.