Re: dialog - absolute beginner problems

From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 10/11/05


Date: Tue, 11 Oct 2005 17:03:31 -0400

On 2005-10-11, darkknight56 wrote:
> Here -
>
> #!/usr/bin/sh
>
> mac()
> {
> count=0
> while read aps
> do
> if [ $count -le $aps ]
> then
> # `dialog --nocancel --backtitle "Network" --title "APs"
> --max-input 17 --clear --inputbox "\nMAC " 10 40 "$mac" > me
> nuitems/mac.txt`
> macnumber=mac${count}
> mac=`cat menuitems/mac.txt`
> count=$ [ $count+1 ]
> rm menuitems/mac.txt
> return #NOTE: Once you enter this if statement, you exit this
> function. No more read from the aps.txt file is done.
> fi
> done < ./menuitems/aps.txt
> }
>
> mac
>
> exit 0
>
> This will work in both Korn and Borne shells. See my previous post,
> though, regarding the 2> and the return statement.

   It might have worked before Google groups mangled it. Please, if
   you must use GG, make sure the lines are short enough so that they
   do not get split by the broken Google interface.

   It will not work in a Bourne shell, even without the line problems
   because a Bourne shell does not do arithmetic. It will not work in
   many POSIX shells because you use a non-standard arithmetic syntax.
   In fact, it doesn't even work in a Korn shell. It should be:

count=$(( $count + 1 ))

   You have commented out the dialog command, which means that there
   will be no file called menuitems/mac.txt, and you'll get an error
   when you try to cat it.

-- 
    Chris F.A. Johnson                     <http://cfaj.freeshell.org>
    ==================================================================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
    <http://www.torfree.net/~chris/books/cfaj/ssr.html>


Relevant Pages

  • Re: How do I delete photographs from an iPad?
    ... shell have to be different. ... the kernel is the same and there is no shell on ios (although ... So you can take the code from an Intel ... powered mac and run it unchanged on an idevice? ...
    (rec.photo.digital)
  • Re: How do I delete photographs from an iPad?
    ... shell have to be different. ... the kernel is the same and there is no shell on ios (although ... So you can take the code from an Intel ... powered mac and run it unchanged on an idevice? ...
    (rec.photo.digital)
  • Re: Running an application more than once
    ... The Mac was introduced in 1984 and was able to run multiple applications ... The shell process just creates a child process, ... It will complicate programming and have no impact on capabilities. ...
    (comp.sys.mac.system)
  • Re: Unity Interface in 10.10 Netbook Edition
    ... OS with a shell environment familiar if you know FreeBSD, ... I use Mac OS X, ... When polish is used to hide defaults I'm not that impressed. ... navigate folders with spaces in their names and from disk to disk, ...
    (Ubuntu)
  • Re: problems w/ my MAC OS 10.5.7 unix?
    ... The unix described there ... differs from that on my Mac. ... Mac OS X no longer makes the tcsh shell default (I think it did up ... case, after freshly launching Terminal and typing the "ps" command, the ...
    (comp.sys.mac.programmer.help)