Linux Shell Programming, In 8 Hours, For Beginners! by Perl Ruby C. & Yao Ray
Author:Perl, Ruby C. & Yao, Ray [Perl, Ruby C.]
Language: eng
Format: epub
Publisher: Ray Yao 's eBooks & Books
Published: 2020-03-20T16:00:00+00:00
-x file
If the object is an executable file, return true .
-e file
If the object is an empty file, return true .
-s file
If the object isn’t an empty file, return true .
-b file
If the object is a block device file, return true .
-c file
If the object is a character device file, return true .
Example 5.2
# Assume that the file “myFile . sh” does not exist, but we still check the property of this file .
#! /bin/bash
file="/root/myFile. sh"
if [ -r $file ] # check if the object is readable
then
echo "The object is readable"
else
echo "The object isn't readable"
fi
if [ -w $file ] # check if the object is writable
then
echo "The object is writable"
else
echo "The object isn't writable"
fi
if [ -x $file ] # check if the object is executable
then
echo "The object is executable"
else
echo "The object isn't executable"
fi
if [ -f $file ] # check if the object is a file
then
echo "The object is a file"
else
echo "The object isn't a file"
fi
if [ -d $file ] # check if the object is a directory
then
echo "The object is a directory"
else
echo "The object isn't a directory"
fi
if [ -s $file ] # check if the object isn’t empty
then
echo "The object isn't empty"
else
echo "The object is empty"
fi
if [ -e $file ] # check if the file is existing
then
echo "The file is existing"
else
echo "The file isn't existing"
fi
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6754)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6731)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6615)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6399)
Driving Data Quality with Data Contracts by Andrew Jones(6342)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6105)
Learning SQL by Alan Beaulieu(5997)
Weapons of Math Destruction by Cathy O'Neil(5784)
Big Data Analysis with Python by Ivan Marin(5371)
Data Engineering with dbt by Roberto Zagni(4370)
Solidity Programming Essentials by Ritesh Modi(4020)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3882)
Pandas Cookbook by Theodore Petrou(3586)
Blockchain Basics by Daniel Drescher(3298)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2909)
Feature Store for Machine Learning by Jayanth Kumar M J(2816)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2798)
Mastering Python for Finance by Unknown(2745)
