Newer
Older
Import / applications / Photoframe / dos.inc
#!/bin/bash

DEBUG=1

function debug()
{
	if [ "$DEBUG" == "1" ]
	then
		echo "$@"
	fi
}

function fix_args1()
{
	while [ $# -ne 0 ]
	do
		# echo -E -- "$1" | tr "\\" "~" | sed "s/ \/\([a-zA-Z0-9]*\)/ -\1/g" | tr "~" "/" | sed "s/^-- //g" | sed "s/%\([a-zA-Z0-9]*\)%/$\{\1\}/g" | tr -d "\n"
		echo -E -- "$1" | tr "\\\\" "/" | sed "s/^-- //g" | sed "s/%\([a-zA-Z0-9]*\)%/$\{\1\}/g" | tr -d "\n"
		echo -n " "
		shift
	done
	# echo -E -- "$@" | tr "\\" "/" | sed "s/^-- //g" | sed "s/%\([a-zA-Z0-9]*\)%/$\{\1\}/g"
}

function fix_args()
{
	ARGS=`fix_args1 ${@}`
	ARGS=`eval echo -- $ARGS | sed "s/^-- //g"`
	echo "$ARGS"
}

function @echo()
{
	debug "Echo:    @echo $@"
}

function rem()
{
	debug "Comment: $@"
}

function copy()
{
	echo '"Copy:  '${@}'"'
	debug "Copy:    `which cp` `fix_args "$@"`"
	`which cp` `fix_args "${@}"`
}

function md()
{
	debug "Mkdir:   `which mkdir` `fix_args $@`"
	`which mkdir` `fix_args "$@"`
}

function cd()
{
	debug "Chdir:   cd `fix_args $@`"
	builtin cd `fix_args "$@"`
}

function set()
{
	debug "Set:     export `fix_args $@`"
	export `fix_args $@`
}

function unzip()
{
	ARGS=`fix_args "$@"`
	debug "Unzip:   `which unzip` $ARGS"
	`which unzip` $ARGS
}

function cmd()
{
	debug "Cmd:     `fix_args $@`"
	if [ "$1" == "/C" ]
	then
		$2
	fi
}

function rmdir()
{
	debug "Rmdir:   rm -rf `fix_args $@`"
}

function del()
{
	debug "Del:     rm -f `fix_args $@`"
}

function pause()
{
	debug "Pause:   `fix_args $@`"
	echo "Press Enter to continue..."
	read
}