saf extractor

Post anything about MX Simulator here. Please. I'm begging you.
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: saf extractor

Post by Wahlamt »

Edo wrote:sorry, can anyone explain me how should i run it? i really can't get it :(
I think you could save it as a shell script, then run it via bash: http://www.windowscentral.com/how-insta ... windows-10
Edo
Posts: 12
Joined: Mon Jan 28, 2019 1:26 pm
Team: Privateer

Re: saf extractor

Post by Edo »

sorry but i don't have windows 10, how can i do this?
Edo
Posts: 12
Joined: Mon Jan 28, 2019 1:26 pm
Team: Privateer

Re: saf extractor

Post by Edo »

my problem is that i'm in the bash but i don't know what to do, i've saved the jlv's script in shell (sh) but then i don't know how to run it because when i run the .sh file it says " saf.sf c..." "saf.sf x <" to create and to extract etc. but when i put into ./saf.sf x <(saf file) it says "no such file or directory" :?:
pls help :(
Edo
Posts: 12
Joined: Mon Jan 28, 2019 1:26 pm
Team: Privateer

Re: saf extractor

Post by Edo »

i hate posting totoo much but, i got it now, i renamed the shell "saf.sf" and then, after i wrote "./saf.sf x <nameofmysaf.saf" and i run it, he shows me this, i can't get out of this . please help.

https://imgur.com/a/PyREGpQ
baker
Posts: 283
Joined: Sat Jul 30, 2011 1:43 pm

Re: saf extractor

Post by baker »

jlv wrote: Mon Oct 07, 2013 9:56 pm Here you go:

Code: Select all

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


#set -C

if test "_$1_" = _c_
then
	shift
	find "$@" -maxdepth 0 -printf '%s %p\n'
	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
Anyone have luck running this under WSL?
baker
Posts: 283
Joined: Sat Jul 30, 2011 1:43 pm

Re: saf extractor

Post by baker »

baker wrote: Tue Jan 25, 2022 3:40 am
jlv wrote: Mon Oct 07, 2013 9:56 pm Here you go:

Code: Select all

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


#set -C

if test "_$1_" = _c_
then
	shift
	find "$@" -maxdepth 0 -printf '%s %p\n'
	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
Anyone have luck running this under WSL?
Nvm, figured it out, I was passing the target directory instead of the saf to stdin.
Post Reply