Trying to put name on gear on a mac

Post your questions here
victorivitch
Posts: 5
Joined: Wed Feb 15, 2017 2:43 am
Team: Privateer
Contact:

Trying to put name on gear on a mac

Postby victorivitch » Wed Sep 25, 2019 5:12 am

Any more tech savy folk out there know how to create a saf file on a mac? I'm struggling here.
Thanks!

User avatar
Wahlamt
Posts: 7397
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Trying to put name on gear on a mac

Postby Wahlamt » Wed Sep 25, 2019 7:08 am

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
   shift
   (for f in "$@"; do wc -c "$f"; done) | awk '{ print $1, $2; }'
   echo -
   cat "$@"
elif test "_$1_" = _x_
then
   shift
   count=0

   while read size name && test "_${size##[^0-9]}_" = "_${size}_"
   do
      sizes[count]=$((size))
      names[count]=${name}
      count=$((count+1))
   done

   if test "_${size}_" != "_-_"
   then
      echo "Bad dir"
      exit
   fi

   i=0
   while let 'i<count'
   do
      echo ${names[i]} ${sizes[i]}
      if test "_${names[i]##*/}_" != "_${names[i]}_"
      then
         install -d "${names[i]%/*}"
      fi
      dd bs=${sizes[i]} count=1 >"${names[i]}" 2>/dev/null
      i=$((i+1))
   done

else
   echo "To create an archive use: saf.sf c files..."
   echo "To extract an archive use: saf.sf x"
fi

There's the code. Save that as a saf.sf file, add the x bit to be able to run it in the terminal. Then:
saf.sf c file1 file2 file3 > file.saf


Return to “Help / Troubleshooting”

Who is online

Users browsing this forum: No registered users and 2 guests