diff options
author | srv <enmanuel.saravia.externo@pandero.com.pe> | 2025-04-28 17:11:28 -0500 |
---|---|---|
committer | srv <enmanuel.saravia.externo@pandero.com.pe> | 2025-04-28 17:11:28 -0500 |
commit | f35a7b0e70032de2feec9f3bda09da44cf0e1073 (patch) | |
tree | 1e0e09581dd3707d0ceb93346452dd14451a8423 /new.sh |
first commit
Diffstat (limited to 'new.sh')
-rw-r--r-- | new.sh | 44 |
1 files changed, 44 insertions, 0 deletions
@@ -0,0 +1,44 @@ +#!/bin/bash + +# Video ID + +videoID=$(date +%s%N | md5sum | head -c 22) + +# Load data +printf '%s' "Enter Title: " +read -r +title="$REPLY" + +printf '%s' "Enter Author: " +read -r +author="$REPLY" + +printf '%s' "Enter Category: " +read -r +category="$REPLY" + +# Slug | lowercase, without accent mark +lug=$(printf '%s' "${title// /-}") +slug=$(echo "$lug" | sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçÇ/aAaAaAaAeEeEiIoOoOoOuUnNcC/' | sed -e 's/\(.*\)/\L\1/') + +printf '%s' "Enter Tags: " +read -r +tag="$REPLY" + +# output +o_videoid=$(printf '%s%s\n' "VideoID: " "$videoID") +o_author=$(printf '%s%s\n' "Author: " "$author") +o_category=$(printf '%s%s\n' "Category: " "$category") +o_date=$(printf '%s%s\n' "Date: " "$(date +"%Y-%m-%d %T")") +o_slug=$(printf '%s%s\n' "Slug: " "$slug") +o_tag=$(printf '%s%s\n' "Tags: " "$tag") +o_title=$(printf '%s%s\n' "Title: " "$title") + +# export to file.md +printf '%s\n%s\n%s\n%s\n%s\n%s\n' "$o_author"\ + "$o_category"\ + "$o_date"\ + "$o_videoid"\ + "$o_slug"\ + "$o_tag"\ + "$o_title" > "$slug.md" |