Check if a File or Directory Exists in Bash

Posted by linuxize on Mar 13, 2019 4:50 AM EDT
linuxize.com; By linuxize
Mail this story
Print this story

In Bash, you can use the test command to check whether a file exists and determine the type of the file.

If you want your script to be portable you should prefer using the old test `[` command which is available on all POSIX shells. The new upgraded version of the test command `[[` (double brackets) is supported on most modern systems using Bash, Zsh, and Ksh as a default shell.

Full Story

  Nav
» Read more about: Groups: GNU

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.