Sponsored Content
Top Forums Shell Programming and Scripting Problem with Darwin typeset -i Post 54928 by Loriel on Friday 27th of August 2004 06:38:58 PM
Old 08-27-2004
Problem with Darwin typeset -i

From the bash manpage:
typeset [-afFirtx] [-p] [name[=value]]

What I'm trying to do is add two values in hexadecimal and have the resulting number display in hexadecimal. What I get is the result displayed in decimal. For instance:
Code:
a=0x10
b=0x30
((c=a+b))
echo $c

...displays 64. The arithmatic is correct, but the format should be 0x40. I tried using typeset -i16 c, but apparently, the option -i doesn't accept parameters in Darwin, so I get this error:
Code:
-bash: typeset: -1: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...

Can anyone help the newbie with a different solution? How can I get the result to display in hexadecimal format?
 

10 More Discussions You Might Find Interesting

1. Programming

ncurses/Darwin

I am using Darwin on Mac OS X.I.I (new to both Unix and C++). I downloaded the ncurses library from http://prdownloads.sourceforge.net/gnu-darwin/ncurses-5.2.tgz, but I don't know what to do with it now. Stuffit has expanded the archive, but I still have the original .tgz as well (if that's... (1 Reply)
Discussion started by: parmenides
1 Replies

2. UNIX for Dummies Questions & Answers

ADSL with Darwin 1.41

Hey everyone, just to let you all know "I'm an uber n00b" I'm connected to Telstra Bigpond's (Australian ISP) ADSL network, now I;m running Darwin 1.41 on an Apple Macintosh PPC computer. I don't know how to set up ADSL on this system, can someone please guide me. (3 Replies)
Discussion started by: Syphor
3 Replies

3. UNIX for Dummies Questions & Answers

Darwin x86

so, what's everyone's opinion on Darwin (x86 rendition)? is it worth installing at the moment? pros? cons? comments? (5 Replies)
Discussion started by: Karma
5 Replies

4. BSD

Darwin via PearPC

How can I send Ctrl+Alt+Del for Darwin running in PearPC for Linux? (1 Reply)
Discussion started by: eugrus
1 Replies

5. UNIX for Dummies Questions & Answers

Open Darwin iso problem.

Very new to OD and unix. I need to know how to create a bootable CD from the ISO. thanks :confused: (3 Replies)
Discussion started by: Front
3 Replies

6. Programming

Problem with curses library on Mac OS 10.2 darwin

Hello, I am trying to write a simple program with functions in the ncurses library, on a Mac running OSX 10.2.8, with the compiler and libraries that were included in the Dec 2002 Developer's tools release (the last one that runs on Jaguar, as far as I know). When I try to compile, I get... (2 Replies)
Discussion started by: marks
2 Replies

7. OS X (Apple)

Darwin 10.4 - Gnome

Hello, I was curious about how one would go about installing gnome on darwin. As far as I know it must be harder than FreeBSD because there doesn't seem to be any ports for it. Would you have to first set up a build environment (GCC etc...) and then compile it from scratch? or is there an... (3 Replies)
Discussion started by: kpedersen
3 Replies

8. UNIX for Dummies Questions & Answers

sed -i on Darwin

This is the first time I've come across this issue sed -i 's/"//g' iscrmireturns sed: 1: "iscrmi": command i expects \ followed by textApparently the -i option is non-standard FreeBSD extensions - does that mean it's not available on Darwin? Strange (1 Reply)
Discussion started by: platz
1 Replies

9. OS X (Apple)

Darwin ports

Hi there. I have an MacBookPro and I want to install Darwin ports. I downloaded & installed MacPorts-1.7.0.pkg and now I don't know what to do. I tried: # port -d selfupdate .... error 1 Command output: checking build system type... i686-apple-darwin9.7.0 checking host system type...... (7 Replies)
Discussion started by: hirohitosan
7 Replies

10. Shell Programming and Scripting

Typeset conversion problem from ksh to bash

Hi, typeset -l sgf # all lowercase letters typeset -u SGF # all uppercase letters sgf=$1 SGF=$sgf these lines used in my scripts . It ran fine in ksh but when we convert this to bash it erroring out. I like to know what the use of typeset ?? Thanks & Regards kanagaraj (3 Replies)
Discussion started by: kanagaraj
3 Replies
typeset(1)                                                         User Commands                                                        typeset(1)

NAME
typeset, whence - shell built-in functions to set/get attributes and values for shell variables and functions SYNOPSIS
typeset [ +- HLRZfilrtux [n]] [ name [ = value]]... whence [-pv] name... DESCRIPTION
typeset sets attributes and values for shell variables and functions. When typeset is invoked inside a function, a new instance of the variables name is created. The variables value and type are restored when the function completes. The following list of attributes may be specified: -H This flag provides UNIX to host-name file mapping on non-UNIX machines. -L Left justify and remove leading blanks from value. If n is non-zero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. When the variable is assigned to, it is filled on the right with blanks or trun- cated, if necessary, to fit into the field. Leading zeros are removed if the -Z flag is also set. The -R flag is turned off. -R Right justify and fill with leading blanks. If n is non-zero it defines the width of the field, otherwise it is determined by the width of the value of first assignment. The field is left filled with blanks or truncated from the end if the variable is reas- signed. The -L flag is turned off. -Z Right justify and fill with leading zeros if the first non-blank character is a digit and the -L flag has not been set. If n is non-zero it defines the width of the field; otherwise, it is determined by the width of the value of first assignment. -f The names refer to function names rather than variable names. No assignments can be made and the only other valid flags are -t, -u and -x. The flag -t turns on execution tracing for this function. The flag -u causes this function to be marked undefined. The FPATH variable will be searched to find the function definition when the function is referenced. The flag -x allows the func- tion definition to remain in effect across shell procedures invoked by name. -i Parameter is an integer. This makes arithmetic faster. If n is non-zero it defines the output arithmetic base; otherwise, the first assignment determines the output base. -l All upper-case characters are converted to lower-case. The upper-case flag, -u is turned off. -r The given names are marked readonly and these names cannot be changed by subsequent assignment. -t Tags the variables. Tags are user definable and have no special meaning to the shell. -u All lower-case characters are converted to upper-case characters. The lower-case flag, -l is turned off. -x The given names are marked for automatic export to the environment of subsequently-executed commands. The -i attribute can not be specified along with -R, -L, -Z, or -f. Using + rather than - causes these flags to be turned off. If no name arguments are given but flags are specified, a list of names (and optionally the values) of the variables which have these flags set is printed. (Using + rather than - keeps the values from being printed.) If no names and flags are given, the names and attributes of all variables are printed. For each name, whence indicates how it would be interpreted if used as a command name. The -v flag produces a more verbose report. The -p flag does a path search for name even if name is an alias, a function, or a reserved word. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
ksh(1), set(1), sh(1), attributes(5) SunOS 5.10 1 Feb 1995 typeset(1)
All times are GMT -4. The time now is 01:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy