Trick for Tests

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

Trick for Tests

#1 Post by jpeps »

Kind of counter-intuitive, but for searching vs editing a password file using [ -e $1 ], this works:

Code: Select all

#!/bin/ash

if [ ! -e $1 ]; then  
  grep -i  $1  /pass.txt
else
  vim /pass.txt
fi

Post Reply