Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 22 Sep 2014, 04:31
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
My Bash script won't run
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
piratesmack


Joined: 16 Sep 2009
Posts: 100

PostPosted: Sun 11 Oct 2009, 20:39    Post_subject:  My Bash script won't run
Sub_title: command not found
 

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:

#!/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

Edited_times_total
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Sun 11 Oct 2009, 22:37    Post_subject:  

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.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
8-bit


Joined: 03 Apr 2007
Posts: 3368
Location: Oregon

PostPosted: Sun 11 Oct 2009, 22:49    Post_subject:  

If I may ask, why not use deb2pet.rpm2pet-0.0.4.pet?
deb2pet.rpm2pet-0.0.4.pet
Description  Converts RPM and DEB packages to PETs
pet

 Download 
Filename  deb2pet.rpm2pet-0.0.4.pet 
Filesize  968 Bytes 
Downloaded  430 Time(s) 
Back to top
View user's profile Send_private_message 
piratesmack


Joined: 16 Sep 2009
Posts: 100

PostPosted: Mon 12 Oct 2009, 15:25    Post_subject:  

Thanks, guys.

The problem was being caused by my text editor (programmers notepad)
I copied and pasted the text into geany and it worked
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0452s ][ Queries: 12 (0.0029s) ][ GZIP on ]