Register
It is currently Fri Apr 25, 2014 3:21 am

Retry Command?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Thu Feb 10, 2011 2:49 pm   

Joined: Mon Feb 07, 2011 5:45 pm
Posts: 4
return to a command if directory not found

I would like to include a command that would loop you back to where you input the name of a file/directory that way when you get it wrong you can either type yes or no yes to retry no to exit

Any help is always appriciated?


Top
 Profile  
 PostPosted: Thu Feb 10, 2011 3:54 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 512
Hi,

there are many ways to achieve your goal, among which, something like this
Code:
until [ -d "$dir" ]
do
   if [ -n "$dir" ]
   then
      echo "$dir is not a directory"
      read -p'wanna retry ? (yes/no, default is yes) '
      [ "$REPLY" = no ] && break
   fi
   read -p'directory : ' dir
done


Top
 Profile  
 PostPosted: Sat Mar 05, 2011 10:27 pm   

Joined: Mon Feb 07, 2011 5:45 pm
Posts: 4
where I have I would like to do the retry command on this


Code:
#!/bin/bash
# Autopatch/chmod by Stryk3rr3al

echo "Basic Version 1.5.2"
echo "created by stryk3rr3al on 2/9/11 ''
echo "checking install of ldid"

ldidloc=`ls -d /usr/bin/`
echo Checking if ldid is installed
if [ ! -e "${ldidloc}/ldid" ] ; then
    echo "Link Identy editor not found"
    exit 1
    fi
echo ''
echo "ldid is installed"
echo ''
read -p  "Enter the Name of the apps folder Ex DoodleJump:"APP1
echo ''
echo "checking apps folder..."
app=${APP1}.app
apploc=`ls -d /var/mobile/Applications/*/${app}`

[b][i][u]if [ ! -d "${apploc}" ] ; then
    echo "Applications folder not found"
    exit 1
    fi[/u][/i][/b]
echo ''
echo "Applications Directory was sucesfully found"
echo ''

read -p "enter the name of the apps binary EX:Doodlejump"BNARY
echo ''

echo "checking for valid binary file..."

if [ ! -e  /var/mobile/Applications/*/${app}/${BNARY} ] ; then
  echo '' 
  echo "Binary File not found"
  exit 1
  fi
echo ''
echo "Application binary located..."
echo ''
echo "Beginning the sining process..."
  cd /var/mobile/Applications/*/${app}
   ldid -s $BNARY
   echo "Binary Signed"
   chmod 755 $BNARY
   echo "Permissions set"
   echo ''
   echo "The applications binary should now be signed and chmodded"
   echo ''
   exit 0
    fi

0


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP