Learning Linux Shell Scripting by Ganesh Sanjiv Naik
Author:Ganesh Sanjiv Naik
Language: eng
Format: epub
Publisher: Packt Publishing
Since the user Ganesh is already created on the computer, the string Ganesh was found in the /etc/passwd file.
$ name=John $ grep "$name" /etc/passwd $ echo $? 1 # non zero values means error
Since the user John was not found in the /etc/passwd file, the grep command returned a nonzero value. In scripts, we can use this during automation.
Understanding the test command
Let's now understand the test command.
Using the test command with single brackets
Let's learn the following example to check the content or value of expressions:
$ test $name = Ganesh $ echo $? 0 if success and 1 if failure.
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.
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7767)
Filmora Efficient Editing by Alexander Zacharias(5796)
The Infinite Retina by Robert Scoble Irena Cronin(5276)
Learn Wireshark - Fundamentals of Wireshark. by Lisa Bock(3983)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3935)
Edit Like a Pro with iMovie by Regit(3435)
Linux Administration Best Practices by Scott Alan Miller(2858)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic & Jasmin Redzepagic(2836)
MCSA Windows Server 2016 Study Guide: Exam 70-740 by William Panek(2522)
Mastering PowerShell Scripting - Fourth Edition by Chris Dent(2406)
Docker on Windows by Stoneman Elton(2319)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2315)
Creative Projects for Rust Programmers by Carlo Milanesi(2256)
Hands-On AWS Penetration Testing with Kali Linux by Karl Gilbert(2109)
Hands-On Linux for Architects by Denis Salamanca(2053)
Programming in C (4th Edition) (Developer's Library) by Stephen G. Kochan(2005)
Computers For Seniors For Dummies by Nancy C. Muir(2003)
The Old New Thing by Raymond Chen(1941)
Linux Kernel Debugging by Kaiwan N Billimoria(1762)
