Get help on Linux typeset Command.


   Linux typeset command is use to set variable value and attributes on Linux system.  The Linux typeset command is one of bash shell built in command.  The command example below show how to get typeset command manual or help on Linux typeset command using shell command, this help show information on how to use the Linux typeset command, the typeset command options and the arguments that can be use with Linux typeset command.


Get Linux typeset command help


  Execute help command and the name of Linux command that we want the help file, the example below we execute help command with -m option to get the help for typeset command using the manpage format.

typeset linux command

[linux@fedora11 ~]$ help -m typeset


    typeset - Set variable values and attributes.



    typeset [-aAfFilrtux] [-p] name[=value] ...



    Set variable values and attributes.


    Obsolete.  See `help declare'.






    GNU bash, version 4.0.16(1)-release (i386-redhat-linux-gnu)

    Copyright (C) 2009 Free Software Foundation, Inc.

    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>


[linux@fedora11 ~]$


Keywords: typeset, typeset command, linux typeset command, typeset linux command, linux command typeset, typeset command manual, typeset manual, typeset help, help typeset, command typeset help, help typeset command   


Command typeset

I'm trying to use the typeset command, but no sucessfull
I am new about programation language.

I wanna copy files from one folder to another, but I must copy one at a time, in sequence,
because before copy the next file (input0002.dat), I must use the first one in other program.
the script is in shell (.sh) and the files are named as follow:
input0001.dat, input0002.dat, ..., input1000.dat

script summary
while [ $a -le 1000 ]
cp A/B/C/inp$a.dat A/B/inp$a.dat
a=`expr $a + 1`

however, variable "a" don't get in as "0001", but only as "1" and obviously it won't copy the file.

I need a form of adding zeroes (0) before the variable "a" for the copy be possible.

I'm trying to add zeroes before the variable "a", as follow:
typeset -Z4 v="$a" where the result is = "0001"
-Z4 indicates 4 characters, counting with the variable "a" (i.e. 3 zeroes + $a = 0001)
but this is not working.

Help me.

help typeset command

Help typeset command shows:

typeset: usage: typeset [afFirtx] [-p] name[=value]...

The -p option will display the attributes and values of each NAME.

The flags are:
-a to make NAMEs arrays (if supported)
-f to select from among function names only
-F to display function names (and line number and source file name if debugging) without definitions
-i to make NAMEs have the `integer' attribute
-r to make NAMEs readonly
-t to make NAMEs have the `trace' attribute
-x to make NAMEs export

I need help to insert zeroes before the variable "a".


I changed the typeset command by the printf command.

The solution to copy files from a directory to another, so that you will use these files in sequence in other program was:

#to know the number of existent files in the directory. In my case, the files were named as inpXX1.dat, where XX=00
cd /directory/A
nfiles=`ls -l *.dat | egrep -c '^-'`
echo "$nfiles" #the result is 100

In my case, there were 100 files, because three characters after name "inpXXX.dat", where XXX=(001, 002, ..., 100)

#Inserting the enough number of zeroes in the instant of copy: "%0Xd", where X is the number of characters

for ((x=1;x<=$nfiles;x+=1))
cp /directory/A/inp$(printf "%03d" $x).dat ../B/inp$(printf "%03d" $x).dat
#After, do what you want with each file...