Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
faui2k17
generator
Commits
9272d5cd
Unverified
Commit
9272d5cd
authored
Aug 15, 2019
by
Philip Kaludercic
🌝
Browse files
added script to quickly create new posts
parent
6e0b18bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
newpost.sh
0 → 100755
View file @
9272d5cd
#!/bin/sh
if
[
$#
-lt
1
]
then
echo
"usage:
$0
title"
>
&2
exit
1
fi
FNAME
=
posts/
$(
echo
"
$@
"
|
sed
's/[[:space:]]+/_/g'
|
tr
'[:upper:]'
'[:lower:]'
)
.md
if
[
-f
"
$FNAME
"
]
then
echo
"post (
\"
$FNAME
\"
) already exists"
>
&2
exit
1
fi
cat
>
"
$FNAME
"
<<
EOF
title:
$@
date:
$(
date
+
"%Y-%m-%d %H:%M"
)
author:
$(
getent passwd
"
$USER
"
|
cut
-d
:
-f5
|
cut
-d
,
-f1
)
tags: news
---
EOF
exec
"
${
EDITOR
:-
vi
}
"
"
$FNAME
"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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