Sponsored Content
Top Forums Shell Programming and Scripting Is there any command in the Bourne shell? Post 302418714 by methyl on Wednesday 5th of May 2010 10:35:27 AM
Old 05-05-2010
Small problem with the data. The second word does not spell "adios".

Code:
DEC=0097  OCT=141  CHAR=a
DEC=0064  OCT=100  CHAR=@
DEC=0069  OCT=105  CHAR=E
DEC=0111  OCT=157  CHAR=o
DEC=0115  OCT=163  CHAR=s
a@Eos

DEC=0097  OCT=141  CHAR=a
DEC=0100  OCT=144  CHAR=d
DEC=0105  OCT=151  CHAR=i
DEC=0111  OCT=157  CHAR=o
DEC=0115  OCT=163  CHAR=s
adios

I used "bc" to convert from decimal to octal then echo to display the character. Neither of these commands are in bash so there is no point in posting my code.

---------- Post updated at 15:35 ---------- Previous update was at 12:18 ----------

One way to convert from decimal to ascii in modern shell (e.g. bash). There may be better methods.

This script outputs the letter "a" by converting decimal 97 to octal 141 (which is held as 8#141) removes the "8#" prefix then outputs the character equivalent of octal 141 with "print".

Code:
typeset -i8 OCT         # Octal number
typeset -i10 DEC        # Decimal number
DEC=97
OCT=${DEC}
# ${OCT} now contains 8#octal_no
# remove 8# prefix
OCT2=${OCT##8#}
print "\0${OCT2}"


Last edited by methyl; 05-05-2010 at 08:24 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

2. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

3. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

4. Shell Programming and Scripting

Maximum command length in bourne shell

Hi, I wanted to know what is the maximum length of command which can be run on a bourne (sh) shell? Where can I find that information? Is it different for different OS flavors? Please help. Thanks, Vineet (10 Replies)
Discussion started by: vineetd
10 Replies

5. Shell Programming and Scripting

I need to understand the differences between the bash shell and the Bourne shell

I do not claim to be an expert, but I have done things with scripts that whole teams of folks have said can not be done. Of course they should have said we do not have the intestinal fortitude to git-r-done. I have been using UNIX actually HPUX since 1992. Unfortunately my old computer died and... (7 Replies)
Discussion started by: awk_sed_hello
7 Replies

6. Shell Programming and Scripting

Bourne Shell Script that only takes command line arguments

Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script? The output should be something like this: User userid has a home directory of /path/directory the default shell for this user is /path/shell (1 Reply)
Discussion started by: ajaira
1 Replies

7. UNIX for Advanced & Expert Users

Bourne Shell Script that only takes command line arguments

Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script? The output should be something like this: User userid has a home directory of /path/directory the default shell for this user is /path/shell (1 Reply)
Discussion started by: ajaira
1 Replies

8. UNIX for Dummies Questions & Answers

Bourne Shell Script that only takes command line arguments

Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script? The output should be something like this: User userid has a home directory of /path/directory the default shell for this user is /path/shell (5 Replies)
Discussion started by: ajaira
5 Replies

9. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

10. AIX

Alias Command in Bourne Shell

Hi My Unix sever is AIX 5.3. My Login shell ( using echo $SHELL) is /bin/sh implying it is a Bourne Shell. My Question is that i am still able to use Alias command to create/retrieve aliases. I have read in several sites on Unix online that the Bourne Shell does not support Aliases but... (12 Replies)
Discussion started by: pchegoor
12 Replies
SETHOST(1)						      General Commands Manual							SETHOST(1)

NAME
sethost - Emulates a DEC VT100 terminal SYNOPSIS
sethost [options] nodename Options: [-Vh] [-e char] DESCRIPTION
sethost emulates a DEC VT100 terminal. This application implements the CTERM protocol over DECnet for connecting to a remote DECnet host emulating a DEC VT100 terminal. dnlogin is a replacement for sethost with more compatibility features. OPTIONS
-e <char> Set the exit character. By default this is ^]. You can specify the exit character as a control character by preceding it with a cir- cumflex eg (^A means control-A) or as a number in decimal (default), octal (starting with a zero), or hexadecimal (preceded by 0x or 0X). -h -? Displays help for using the command. -V Show the version of the package that sethost was built with. EXAMPLES
Connect to remote VAX host named "mv3100". sethost mv3100 HELPFUL HINTS
The CTERM specifications available from Digital does not include how to setup VMS terminal characteristics, so the host cannot identify the capabilities of the session we are creating. The simplest workaround is to set the terminal capabilities manually upon login or including the following command in the login.com DCL procedure. $ SET TERM/DEC_CRT SEE ALSO
dntype(1), dndir(1), dndel(1), dntask(1), dnping(1) DECnet utilities July 27 1998 SETHOST(1)
All times are GMT -4. The time now is 07:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy