Testing commands while redirecting output
#!/bin/bash
if [ $# != 1 ]
then
echo "Usage: $0 username"
exit 1
fi
if grep "$1" /etc/passwd > /dev/null
then
echo "Found $1 in /etc/passwd"
fi
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
#!/bin/bash
if [ $# != 1 ]
then
echo "Usage: $0 username"
exit 1
fi
if grep "$1" /etc/passwd > /dev/null
then
echo "Found $1 in /etc/passwd"
fi