28 lines
801 B
Bash
Executable file
28 lines
801 B
Bash
Executable file
#!/bin/bash
|
|
|
|
export SMBPATH="smb.txt"
|
|
|
|
export SMBID=$RANDOM
|
|
|
|
echo "welcome to smb"
|
|
|
|
if [[ ! -f $SMBPATH ]];then
|
|
read -p "Initilize smb in $SMBPATH ? "
|
|
echo "--top--" >> $SMBPATH
|
|
fi
|
|
|
|
read -p "title your post: " TITLE
|
|
|
|
mkdir /tmp/smb/$USER/ -p
|
|
vim /tmp/smb/$USER/$SMBID
|
|
if [[ -f "/tmp/smb/$USER/$SMBID" ]];then
|
|
echo "================================================================================">> /tmp/smb/$USER/$SMBID.t
|
|
echo "Title: $TITLE" >> /tmp/smb/$USER/$SMBID.t
|
|
date "+Posted on: %Y-%m-%d\\" | tr '\\\\' "\n" >> /tmp/smb/$USER/$SMBID.t
|
|
cat /tmp/smb/$USER/$SMBID >> /tmp/smb/$USER/$SMBID.t
|
|
echo -e "================================================================================\n\n" >> /tmp/smb/$USER/$SMBID.t
|
|
sed -i "/--top--/r /tmp/smb/$USER/$SMBID.t" $SMBPATH
|
|
else
|
|
echo "aborting..."
|
|
fi
|
|
|