Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test1=`sed -i "/:@/c connection.url=jdbc:oracle:thin:@$ip:1521:$dataBase" $search`
- valid $test1
- function valid () {
- if $test -eq 1; then
- echo "OK"
- else echo "ERROR"
- fi
- }
- some_command
- if [ $? -eq 0 ]; then
- echo OK
- else
- echo FAIL
- fi
- some_command
- retval=$?
- do_something $retval
- if [ $retval -ne 0 ]; then
- echo "Return code was not zero but $retval"
- fi
- if some_command; then
- printf 'some_command succeededn'
- else
- printf 'some_command failedn'
- fi
- if output=$(some_command); then
- printf 'some_command succeded, the output was «%s»n' "$output"
- fi
- command && echo OK || echo Failed
- cd /nonexistant
- if [ $? -ne 0 ]
- then
- echo failed
- else
- echo success!
- fi
- command && echo $? || echo $?
- $ find . -name "not_existing_file"
- $ echo $?
- 0
- $ file ./not_existing_file
- ./not_existing_file: cannot open `./not_existing_file' (No such file or directory)
- $ echo $?
- 0
- $ file ./doesntexist | while IFS= read -r output; do
- > case "$output" in
- > *"No such file or directory"*) printf "%sn" "This will show up if failed";;
- > *) printf "%sn" "This will show up if succeeded" ;;
- > esac
- > done
- This will show up if failed
- $ find . -name "doesn'texist" | if ! read IFS= out; then echo "File not found"; fi
- File not found
- error="$([COMMAND] $1 2>&1 >/dev/null)"
- if [ $? -ne 0 ]; then
- echo "[THIS-FUNCTION]: $error"
- exit 1
- fi
Add Comment
Please, Sign In to add comment