Blame tests/p_coreutils/yes.sh
|
Alice Kaerast |
a5b9f7 |
#!/bin/bash
|
|
Alice Kaerast |
a5b9f7 |
# Author: Alice Kaerast <alice@kaerast.info>
|
|
Alice Kaerast |
a5b9f7 |
|
|
Alice Kaerast |
a5b9f7 |
t_Log "$0 - Test yes command"
|
|
Alice Kaerast |
a5b9f7 |
|
|
Alice Kaerast |
a5b9f7 |
# Create test files
|
|
Alice Kaerast |
a5b9f7 |
touch /var/tmp/test-yes-123
|
|
Alice Kaerast |
a5b9f7 |
touch /var/tmp/test-yes-456
|
|
Alice Kaerast |
a5b9f7 |
|
|
Alice Kaerast |
a5b9f7 |
# -i makes rm ask for confirmation with 'y' so pipe yes to it
|
|
Alice Kaerast |
a5b9f7 |
yes | rm -i /var/tmp/test-yes-* || exit 1
|
|
Alice Kaerast |
a5b9f7 |
|
|
Alice Kaerast |
a5b9f7 |
#Set deleted to 1, until we've succesfully tested that the files have gone
|
|
Alice Kaerast |
a5b9f7 |
deleted=1
|
|
Alice Kaerast |
a5b9f7 |
#Test that the files don't exist then set deleted=0
|
|
Alice Kaerast |
a5b9f7 |
test -f /var/tmp/test-yes-123 || test -f /var/tmp/test-yes-456 || deleted=0
|
|
Alice Kaerast |
a5b9f7 |
t_CheckExitStatus $deleted
|