Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Stack/UnixPipes/stack-1.up
Normal file
11
Task/Stack/UnixPipes/stack-1.up
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
init() { if [ -e stack ]; then rm stack; fi } # force pop to blow up if empty
|
||||
push() { echo $1 >> stack; }
|
||||
pop() {
|
||||
tail -1 stack;
|
||||
x=`head -n -1 stack | wc -c`
|
||||
if [ $x -eq '0' ]; then rm stack; else
|
||||
truncate -s `head -n -1 stack | wc -c` stack
|
||||
fi
|
||||
}
|
||||
empty() { head -n -1 stack |wc -l; }
|
||||
stack_top() { tail -1 stack; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue