diff options
author | login | 2023-06-18 17:59:36 +0000 |
---|---|---|
committer | login | 2023-06-18 17:59:36 +0000 |
commit | c1a67ff9b8df9b0249a73bc964a9be6a9a4a6e96 (patch) | |
tree | 826a8bfb5843555db22b9c7ce4d697d08afbd142 /npcoin | |
parent | f5a91acd55e23a2f265f85e2ff70ffae1d10031a (diff) |
Fixing npcoin to initialise _MESSAGES.txt with "" instead of "0"
npcoin should initialise _MESSAGES.txt with "" instead of "0"
Diffstat (limited to 'npcoin')
-rwxr-xr-x | npcoin | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/npcoin b/npcoin index 31dd4f4..72588d0 100755 --- a/npcoin +++ b/npcoin @@ -0,0 +1,53 @@ +#!/bin/bash + +if [ "$#" -eq 0 ] || [ "${@^}" = "--help" ] || [ "${@^}" = "-h" ] +then + /bin/echo "Usage:" + /bin/echo " npcoin <Nameofprogram> : to create pcoin directories for <Nameofprogram> (this should be run in the \"tcoin\" folder's containing directory)" + /bin/echo " npcoin [ --help | -h ] : to print this help" +else + if [ -e "./tcoin/${@^}.txt" ] + then + /bin/echo "Sorry, './tcoin/${@^}.txt' already exists." + exit 1 + else + /bin/echo "0" > "./tcoin/${@^}.txt" + /bin/chmod 600 "./tcoin/${@^}.txt" + fi + + if [ -e "./tcoin/messages/${@^}_messages.txt" ] + then + /bin/echo "Sorry, './tcoin/messages/${@^}_messages.txt' already exists." + exit 1 + else + /usr/bin/touch "./tcoin/messages/${@^}_messages.txt" + /bin/chmod 600 "./tcoin/messages/${@^}_messages.txt" + fi + + if [ -e "./tcoin/program_accounting/${@^}" ] + then + /bin/echo "Sorry, './tcoin/program_accounting/${@^}' aleady exists." + exit 1 + else + /bin/mkdir "./tcoin/program_accounting/${@^}" + /bin/chmod 700 "./tcoin/program_accounting/${@^}" + fi + + if [ -e "./tcoin/program_accounting/${@^}/_TOTAL.txt" ] + then + /bin/echo "Sorry, './tcoin/program_accounting/${@^}/_TOTAL.txt' already exists." + exit 1 + else + /bin/echo "0" > "./tcoin/program_accounting/${@^}/_TOTAL.txt" + /bin/chmod 600 "./tcoin/program_accounting/${@^}/_TOTAL.txt" + fi + + if [ -e "./tcoin/program_accounting/${@^}/_MESSAGES.txt" ] + then + /bin/echo "Sorry, './tcoin/program_accounting/${@^}/_MESSAGES.txt' already exists." + exit 1 + else + /bin/echo "" > "./tcoin/program_accounting/${@^}/_MESSAGES.txt" + /bin/chmod 600 "./tcoin/program_accounting/${@^}/_MESSAGES.txt" + fi +fi |