Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function conditional-do {
- if [ -f $1 ]
- then
- echo "Doing stuff"
- $2
- else
- echo "File doesn't exist!"
- end
- }
- function exec-stuff {
- echo "do some command"
- echo "do another command"
- }
- conditional-do /path/to/file exec-stuff
- function file_exists {
- if ( [ -e $1 ] ) then
- echo "Doing stuff"
- else
- echo "File $1 doesn't exist"
- false
- fi
- }
- file_exists filename && (
- echo "Do your stuff..."
- )
- file_exists filename && echo "Do your stuff..."
- function file_exists {
- if ( [ -e $1 ] ) then
- echo "Doing stuff"
- shift
- $*
- else
- echo "File $1 doesn't exist"
- false
- fi
- }
- file_exists filename echo "Do your stuff..."
- [ -f $filename ] && echo "it has worked!"
- function file-exists {
- [ "$1" ] && [ -f $1 ]
- }
- file-exists $filename && echo "It has worked"
Add Comment
Please, Sign In to add comment