Skip to content

Instantly share code, notes, and snippets.

@dsprenkels
Last active May 8, 2018 08:57
Show Gist options
  • Save dsprenkels/d512dae9f7a4d97bf0d1847918ce17c9 to your computer and use it in GitHub Desktop.
Save dsprenkels/d512dae9f7a4d97bf0d1847918ce17c9 to your computer and use it in GitHub Desktop.
#/usr/bin/env bash
alias prev='cd ../"$(ls -F .. | grep '/' | grep -B1 -xF "${PWD##*/}/" | head -n 1)"'
alias next='cd ../"$(ls -F .. | grep '/' | grep -A1 -xF "${PWD##*/}/" | tail -n 1)"'
function cdroot() {
while [[ $PWD != '/' && ! $(basename $(dirname $(pwd))) =~ [A-Za-z0-9]+-Assignment_[0-9]+ ]]; do cd ..; done
}
function ne {
cdroot
next
ID=$(ls ../ | grep -e "^s[0-9]*$" | grep -n `basename $PWD` | cut -d: -f1)
TOTAL=$(ls ../ | grep -e "^s[0-9]*$" | wc -l)
echo $ID "/" $TOTAL
grep "Name: " s*.txt
}
function n {
ne
op
}
function op {
killall -9 atom
atom s*.txt & disown
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment