linux - bash script zip filename parsing strangely -


i'm trying zip various files (one of included files zip itself) , name resulting zip based on handful of bash variables defined earlier. 1 of variables used in zip file name being parsed #define in config.h file. parsed .zip correct name, when tried implement same zip script in different situation erroneous zip names.

in windows explorer, erroneous zip name looks x1276n~e.zip in linux zip appears intended name except question mark (which i've come understand sort of placeholder). i.g. foo-stuff-bar-9.1b?.zip

my current code trying zip file name foo-stuff-bar-9.1b.zip:

foo_name=$1 bar_name=$2 rev_number=$(grep define[[:space:]]*some_number $directory/config.h | awk '{print $3;}'| tr -d '/"') archive_name="$foo_name"-stuff-"$bar_name"-9."$rev_number" zip "$archive_name".zip file1 file2 backup1.zip file3 

so "foo_name" , "bar_name" strings coming terminal when script run, "rev_number" being parsed config.h, , i'm formatting "archive_name" before using in zip command.

i've tried sorts of variations of quotation marks , brackets , same weird name name no matter try. i'm not sure error being caused i'm parsing many sources. advice appreciated.

per marc b's suggestion, piped string xxd -b @ each character byte byte. appeared though accidentally parsing character @ end of $archive_name when scraping config.h file.

i able fix piping string through tr -d "[:cntrl:]" remove control characters give weird file names.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -