Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon May
config
Commits
d3805326
Commit
d3805326
authored
Feb 12, 2021
by
Simon May
Browse files
Add shell functions to get most recent file in a directory
parent
2f0f4b7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
.alias
View file @
d3805326
...
...
@@ -13,6 +13,21 @@ alias afs-auth='kinit smay@MPA-GARCHING.MPG.DE && aklog mpa-garching.mpg.de'
alias touch-r='find . -type f -exec touch "{}" +'
nth-last() {
num=1
if [ -n "$1" ]; then
num="$1"
fi
tail -"$num" | head -1
}
newest-file() {
num=1
if [ -n "$2" ]; then
num="$2"
fi
realpath -m --relative-base=. "$1"/$(ls -1rt "$1" | nth-last "$num")
}
# SLURM aliases
alias sq='squeue -o "%.8Q %.8i %16j %7u %2t %.16V %.16S %.8M %.3D %R" -S "-t,-Q,i"'
alias sq-long='squeue -o "%.8Q %.5i %63j %7u %2t %.16V %.16S %.8M %.3D %R" -S "-t,-Q,i"'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment