Skip to content

Commit

Permalink
Add setlist, next and previous functions to NetOSC.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Rippert committed Mar 21, 2018
1 parent 51d0010 commit 9723080
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/OSCsaveall
50 changes: 46 additions & 4 deletions NetOSC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ tmpfiles=()
proctree=()
pausetree=()
prgmlist=()
setlistarray=()
activeprgm=""

list_descendants () {
Expand Down Expand Up @@ -187,6 +188,45 @@ function pch2 {
echo "$@" > $cpipe
done } &
}

function setlist {
setlistindex=-1
setlistarray=( "$@" )
}

function next {
case $setlistindex in
-1)
setlistindex=0
echo "prgm ${setlistarray[setlistindex]}" > $cpipe
;;
$((${#setlistarray[@]}-1)))
echo "prgm ${setlistarray[setlistindex]}" > $cpipe
echo "End of SetList"
;;
*)
setlistindex=$((setlistindex+1))
echo "prgm ${setlistarray[setlistindex]}" > $cpipe
;;
esac
}

function previous {
case $setlistindex in
-1)
setlistindex=0
echo "prgm ${setlistarray[setlistindex]}" > $cpipe
;;
0)
echo "prgm ${setlistarray[setlistindex]}" > $cpipe
echo "Beginning of SetList"
;;
*)
setlistindex=$((setlistindex-1))
echo "prgm ${setlistarray[setlistindex]}" > $cpipe
;;
esac
}

function list {
echo "Number of commands running: ${#proctree[@]} "
Expand Down Expand Up @@ -321,7 +361,8 @@ function pause {
pausetree[(($1-1))]="P"
;;
*)
kill -STOP "${prnarray[0]}"
tokill="$(list_descendants ${prnarray[0]}) ${prnarray[0]}"
kill -STOP $tokill
pausetree[(($1-1))]="P"
;;
esac
Expand All @@ -339,7 +380,8 @@ function resume {
pausetree[(($1-1))]=" "
;;
*)
kill -CONT "${prnarray[0]}"
tokill="$(list_descendants ${prnarray[0]}) ${prnarray[0]}"
kill -CONT $tokill
pausetree[(($1-1))]=" "
;;
esac
Expand Down Expand Up @@ -369,7 +411,7 @@ if [ $# -gt 2 ]
"$@"
cmdarray=( "$@" )
case ${cmdarray[0]} in
list|prune|pause|resume|load|snapload|save|append)
list|prune|pause|resume|load|snapload|save|append|next|previous|setlist)
;;
prgm|global)
exists=0
Expand Down Expand Up @@ -403,7 +445,7 @@ do
if [[ $(compgen -A function) = *"${cmdarray[0]}"* ]]; then
$cmd
case ${cmdarray[0]} in
list|prune|pause|resume|load|snapload|save|append)
list|prune|pause|resume|load|snapload|save|append|next|previous|setlist)
;;
prgm|global)
exists=0
Expand Down

0 comments on commit 9723080

Please sign in to comment.