For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
piratesmack
Posts: 100 Joined: Wed 16 Sep 2009, 14:22
#1
Post
by piratesmack » Mon 12 Oct 2009, 00:39
Whenever I try to run my script, I get " : command not found"
I can't figure out what's causing it
Here's the script
Code: Select all
#!/bin/bash
#pkg2pet convert deb or rpm to pet
pkgtypefunc() {
local PKG="$1"
BASENAME=$(basename "$PKG")
PKGTYPE="${BASENAME##*.}"
case $PKGTYPE in
deb)
echo Found Debian package: $BASENAME
;;
rpm)
echo Found RPM package: $BASENAME
;;
*)
echo Unknown/unsupported package: $BASENAME
exit 1
;;
esac
}
DIALOG="Xdialog"
[ -z "$DISPLAY" ] && DIALOG="dialog"
if [ "$#" = "0" ]; then
ARGS=$($DIALOG --stdout --title "Select a package" --fselect $HOME 0 0)
RET=$?
case $RET in
0)
#do nothing
;;
*)
exit $RET
;;
esac
else
ARGS="$@"
fi
for PKG in $ARGS; do
if [ ! -e "$PKG" ]; then
echo $PKG not found
exit 1
fi
pkgtypefunc "$PKG"
case $PKGTYPE in
deb)
PETNAME="${BASENAME%%.deb}"
TMP="/tmp/$PKGTYPE/$PETNAME"
mkdir -p "$TMP"
dpkg-deb -x "$PKG" "$TMP" || exit 1
;;
rpm)
PETNAME="${BASENAME%%.rpm}"
TMP="/tmp/$PKGTYPE/$PETNAME"
mkdir -p "$TMP"
( cd "$TMP" || exit 1
rpm2cpio "$PKG" | cpio -vid || exit 1
)
;;
esac
( cd "$TMP" || exit 1
echo \
"PETMENUDESCR=''
PETOFFICIALDEPS''
PETREGISTER='yes'" \
> $PETNAME.pet.specs
cd ..
tar -cvzf "$PETNAME.tar.gz" "$PETNAME"
tgz2pet "$PETNAME.tar.gz"
)
done
Last edited by
piratesmack on Mon 12 Oct 2009, 19:28, edited 3 times in total.
technosaurus
Posts: 4853 Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:
#2
Post
by technosaurus » Mon 12 Oct 2009, 02:37
If you modified your permissions to make it executable then the next step is to put echo 1 ..... echo 999 throughout the code and see where it is. That's my crude bash debugging technique - similar to assert() in C programs.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
8-bit
Posts: 3406 Joined: Wed 04 Apr 2007, 03:37
Location: Oregon
#3
Post
by 8-bit » Mon 12 Oct 2009, 02:49
If I may ask, why not use deb2pet.rpm2pet-0.0.4.pet?
Attachments
deb2pet.rpm2pet-0.0.4.pet
Converts RPM and DEB packages to PETs (968 Bytes) Downloaded 627 times
piratesmack
Posts: 100 Joined: Wed 16 Sep 2009, 14:22
#4
Post
by piratesmack » Mon 12 Oct 2009, 19:25
Thanks, guys.
The problem was being caused by my text editor (programmers notepad)
I copied and pasted the text into geany and it worked