Sponsored Content
Operating Systems OS X (Apple) A fixed point basic calculator for DASH. Post 303025626 by MadeInGermany on Wednesday 7th of November 2018 06:11:47 PM
Old 11-07-2018
Code:
IFS="$IFS"'.'

has a permanent effect, so you often do
Code:
oldIFS=$IFS
IFS="$IFS"'.'
# shell code that needs the modified IFS
# restore the old IFS
IFS=$oldIFS
# normal shell code

Sometimes you can use a sub shell:
Code:
(
# this is a sub shell
IFS="$IFS"'.'
# shell code that needs the modified IFS
)
# in the main shell there is the old IFS

read is a command, and you can set the environment just for the command
Code:
IFS="$IFS"'.' read ...
# after the command there is the old IFS

Unfortunately set is not a command. (You can call it a pseudo command or special command. The shell does not fork/exec like with a normal command, therefore IFS must be set beforehand.)

Last edited by MadeInGermany; 11-07-2018 at 07:24 PM..
This User Gave Thanks to MadeInGermany For This Post:
 

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Fibre connection Point to Point SUN

Anyone know of a guide or instructions for Solaris I got to configure a SBUS HBA to talk to a tape robot. I have done this on a switch but not point to point. just going HBA >>>>> TAPE Fibre simple two nodes Kie (6 Replies)
Discussion started by: kie
6 Replies

2. UNIX for Dummies Questions & Answers

dash after ampersant

Hi! I'm new in these forums and more or less new with Unix. So... here is the question: does anyone know where is redirected the output of a command when you put >&- after it? Does it means any standard file descriptor? Thanks! (2 Replies)
Discussion started by: csecnarf
2 Replies

3. Shell Programming and Scripting

How to perform a hexdump using dd from start point to end point?

hi, I would like to ask or is it possible to dump a hex using dd from starting point to end point just like the "xxd -s 512 -l 512 <bin file>" I know the redirect hexdump -C but i can't figure it out the combination options of dd. Hope someone can share their knowledge.. Thanks in... (3 Replies)
Discussion started by: jao_madn
3 Replies

4. Post Here to Contact Site Administrators and Moderators

How to sum up data in fixed width file with decimal point?

HI Everyone, I have below source file AAA|NAME1|ADDRESS1|300.20 BBB|NAME2|ADDRESS2|400.31 CCC|NAME3|ADDRESS3|300.34 I have requirement where I need to sum up fourth field in above fixed width pipe delimited flat file. When I use below code, it gives me value 1001.00 But I am expecting... (1 Reply)
Discussion started by: patricjemmy6
1 Replies

5. Shell Programming and Scripting

Fixed mount point for a USB cardreader (Raspberry Pi, UDEV)

Hey all! :) I'm trying to create a fixed mount point for an usb cardreader. I've found a script on a raspberry pi forum which does the following: usb stick is plugged in -> script checks the mount point for data -> script starts copying the files automatically -> script unmounts the... (0 Replies)
Discussion started by: Eomer
0 Replies

6. UNIX for Beginners Questions & Answers

How to create a new mount point with 600GB and add 350 GBexisting mount point? IN AIX

How to create a new mount point with 600GB and add 350 GBexisting mount point Best if there step that i can follow or execute before i mount or add diskspace IN AIX Thanks (2 Replies)
Discussion started by: Thilagarajan
2 Replies

7. Shell Programming and Scripting

A dash to GOTO or a dash from GOTO, that is the question...

Well, guys I saw a question about GOTO for Python. So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too). Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'... This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies
command(1)							   User Commands							command(1)

NAME
command - execute a simple command SYNOPSIS
command [-p] command_name [argument...] command [-v | -V] command_name DESCRIPTION
The command utility causes the shell to treat the arguments as a simple command, suppressing the shell function lookup. If the command_name is the same as the name of one of the special built-in utilities, the special properties will not occur. In every other respect, if command_name is not the name of a function, the effect of command (with no options) will be the same as omitting command. The command utility also provides information concerning how a command name will be interpreted by the shell. See -v and -V. OPTIONS
The following options are supported: -p Performs the command search using a default value for PATH that is guaranteed to find all of the standard utilities. -v Writes a string to standard output that indicates the path or command that will be used by the shell, in the current shell execu- tion environment to invoke command_name, but does not invoke command_name. o Utilities, regular built-in utilities, command_names including a slash character, and any implementation-provided functions that are found using the PATH variable will be written as absolute path names. o Shell functions, special built-in utilities, regular built-in utilities not associated with a PATH search, and shell reserved words will be written as just their names. o An alias will be written as a command line that represents its alias definition. o Otherwise, no output will be written and the exit status will reflect that the name was not found. -V Writes a string to standard output that indicates how the name given in the command_name operand will be interpreted by the shell, in the current shell execution environment, but does not invoke command_name. Although the format of this string is unspecified, it will indicate in which of the following categories command_name falls and include the information stated: o Utilities, regular built-in utilities, and any implementation-provided functions that are found using the PATH variable will be identified as such and include the absolute path name in the string. o Other shell functions will be identified as functions. o Aliases will be identified as aliases and their definitions will be included in the string. o Special built-in utilities will be identified as special built-in utilities. o Regular built-in utilities not associated with a PATH search will be identified as regular built-in utilities. o Shell reserved words will be identified as reserved words. OPERANDS
The following operands are supported: argument One of the strings treated as an argument to command_name. command_name The name of a utility or a special built-in utility. EXAMPLES
Example 1: Making a version of cd that always prints out the new working directory exactly once cd() { command cd "$@" >/dev/null pwd } Example 2: Starting off a ``secure shell script'' in which the script avoids being spoofed by its parent IFS=' ' # The preceding value should be <space><tab><newline>. # Set IFS to its default value. unalias -a # Unset all possible aliases. # Note that unalias is escaped to prevent an alias # being used for unalias. unset -f command # Ensure command is not a user function. PATH="$(command -p getconf _CS_PATH):$PATH" # Put on a reliable PATH prefix. # ... At this point, given correct permissions on the directories called by PATH, the script has the ability to ensure that any utility it calls is the intended one. It is being very cautious because it assumes that implementation extensions may be present that would allow user func- tions to exist when it is invoked. This capability is not specified by this document, but it is not prohibited as an extension. For exam- ple, the ENV variable precedes the invocation of the script with a user startup script. Such a script could define functions to spoof the application. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of command: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. PATH Determine the search path used during the command search, except as described under the -p option. EXIT STATUS
When the -v or -V options are specified, the following exit values are returned: 0 Successful completion. >0 The command_name could not be found or an error occurred. Otherwise, the following exit values are returned: 126 The utility specified by command_name was found but could not be invoked. 127 An error occurred in the command utility or the utility specified by command_name could not be found. Otherwise, the exit status of command will be that of the simple command specified by the arguments to command. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), type(1), attributes(5), environ(5), standards(5) SunOS 5.10 17 Jul 2002 command(1)
All times are GMT -4. The time now is 11:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy