diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2024-01-30 06:22:51 +0200 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2024-01-30 06:22:51 +0200 |
commit | 1111b62d12a1df9cbfcc480e3e21e7be554c116d (patch) | |
tree | fcf18b6eb3a7b239b5cf3fb4aba16e392d308b07 /bin | |
parent | fcca3cfad1008459b30a09ad245458f83d213806 (diff) | |
download | arching-kaos-tools-1111b62d12a1df9cbfcc480e3e21e7be554c116d.tar.gz arching-kaos-tools-1111b62d12a1df9cbfcc480e3e21e7be554c116d.tar.bz2 arching-kaos-tools-1111b62d12a1df9cbfcc480e3e21e7be554c116d.zip |
Fixed add subcommand bug
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ak-news | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/ak-news b/bin/ak-news index 1b6ff9b..8175aba 100755 --- a/bin/ak-news +++ b/bin/ak-news @@ -90,10 +90,12 @@ import(){ } add2(){ TEMP="$(ak-tempassin)" - cd $TEMP - if [ -f $1 ]; then - FILE="$1" + if [ -f "$1" ]; then + FILE="$(realpath $1)" cp $FILE $ZNEWSDIR + cp $FILE $TEMP + FILE="$(basename $1)" + cd $TEMP echo "Adding news from " $FILE DATETIME=$(echo $FILE | cut -d - -f 1 | awk '{print $1}') TITLE=$(head -n 1 $FILE) @@ -105,7 +107,7 @@ add2(){ { "datetime":"$DATETIME", "title":"$TITLE", - "filename":"$FILE", + "filename":"$(basename $FILE)", "ipfs":"$FILE_IPFS_HASH", "detach":"$FILE_SIGNATURE" } @@ -122,6 +124,7 @@ EOF echo "error??" exit 1 fi + rm -rf $TEMP } add(){ TEMP="$(ak-tempassin)" |