07-17-2006
Quote:
Originally Posted by Jones Lin
Thanks for your kindly support, but I still cannot run smoothly,
I consider the loop has a issue, the result was as attached,
SYSTEM NEW LAST
==================
pp01 ==========>NA
pp02 ==========>NA
pp03 ==========>NA
pp04 ==========>NA
.........
My script was as follows,
echo "SYSTEM NEW LAST"
echo "======================"
for test_name in $(grep -e "pp" $test_list | awk '{ print $2 }')
do
echo "$test_name\c"
[ $( ls -1 $pc_dir | grep -c $test_name ) -eq 0 ] && echo "$test_name ===========> N/A"
continue
for filename in $( ls -1 $pc_dir )
do
ext=$(echo $filename | awk -F. '{print $2}')
pc_name=$(echo $filename | awk -F _ '{print $2 "_" $3}')
if [ "$ext" = "new" ]
then
echo "$test_name ${pc_name%.new}"
elif [ "$ext" = "last" ]
then
echo "$test_name ${pc_name%.last}"
fi
done
done
Could you provide some sample file names, if it still doesn't works.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
How do I get my working directory always shown in the unix editor? i.e if I am now at /Home/abc/xyz/, I want to see this absolute path displayed ( and now only display when I type pwd).
thanks for the kind help.
Regrads (3 Replies)
Discussion started by: swchee
3 Replies
2. Solaris
Is there a way to supress the banner from being shown when you log in? (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies
3. Solaris
Hi,
On solaris 10, t5120,
I don't understand what are the last 2 file systems
so last 2 file systems what are they, why are they getting shown and also confused why the swap is shown so many times and different size when I set it to 16 G at the time of installing solaris 10. ( rest... (3 Replies)
Discussion started by: upengan78
3 Replies
4. Solaris
Hello,
This is a 2 node sun cluster 3.2 on solaris 10(x86)
I am using an unique ~512M disk (c0d1) on each node and slice 6 on this disk for globaldevices. While everything looks like fine, the 'Fail' is bothering me.
@ tommy_sun1
@tommy_sun
-bash-3.00# cldevice refresh... (10 Replies)
Discussion started by: upengan78
10 Replies
5. UNIX for Advanced & Expert Users
Hello all,
I am facing a memory related issue on my linux that is CentOS 4.0. What I see as an output of top command, free command is that memory usage is almost 90% which is quite high without much load on the system. This is continuously showing 90% or so of memory usage with top or free... (2 Replies)
Discussion started by: radiatejava
2 Replies
6. IP Networking
I have a TCPIP server application (a Vendor package) which by default allows 10 connections. It provides a parameter to allow us to increase the maximum allowable connections in case it is needed. Intermittently this application is failing with maximum number of connections reached even when there... (1 Reply)
Discussion started by: AIX_user
1 Replies
7. Solaris
Hi
I am using the dd command on solaris 10 and the output doesn't include the MB/s statistic that you get in Linux,
is this not available or am I missing a switch of some sort
#dd if=/dev/urandom of=/perf_test/file.txt bs=1048576 count=500
0+500 records in
0+500 records out (2 Replies)
Discussion started by: eeisken
2 Replies
8. UNIX for Advanced & Expert Users
Heyas
I'm trying to read out a file which contains a variable and use that list to complete a bash command.
Difficult part on this is, that 2 (actualy 3) different lists are to be used, but the 'dynamic' ones from the external file dont work properly.
It only seems to work with the list... (2 Replies)
Discussion started by: sea
2 Replies
9. UNIX for Dummies Questions & Answers
I'm currently running a CUPS server and it shows the printers on other computers just fine, but after a while they disappear. I found out, that restarting /etc/init.d/cups-browsed fixes the problem (for about 15min).
When the printers disappear, the cups-browsed service is still running, so I... (0 Replies)
Discussion started by: Gajeela
0 Replies
10. Ubuntu
Hello,
I have just installed ubuntu 16.04 into my pc.
Locally everything works fine, it takes data from internet, I am also able to connect to apache in the same local network. When I try to reach from mobile network, I can't establish ssh, apache site is not displaying in my browser etc.
... (17 Replies)
Discussion started by: baris35
17 Replies
LEARN ABOUT MOJAVE
mktemp
MKTEMP(1) BSD General Commands Manual MKTEMP(1)
NAME
mktemp -- make temporary file name (unique)
SYNOPSIS
mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
DESCRIPTION
The mktemp utility takes each of the given file name templates and overwrites a portion of it to create a file name. This file name is
unique and suitable for use by the application. The template may be any file name with some number of 'Xs' appended to it, for example
/tmp/temp.XXXX. The trailing 'Xs' are replaced with the current process number and/or a unique letter combination. The number of unique
file names mktemp can return depends on the number of 'Xs' provided; six 'Xs' will result in mktemp selecting 1 of 56800235584 (62 ** 6) pos-
sible file names. On case-insensitive file systems, the effective number of unique names is significantly less; given six 'Xs', mktemp will
instead select 1 of 2176782336 (36 ** 6) possible unique file names.
If mktemp can successfully generate a unique file name, the file is created with mode 0600 (unless the -u flag is given) and the filename is
printed to standard output.
If the -t prefix option is given, mktemp will generate a template string based on the prefix and the _CS_DARWIN_USER_TEMP_DIR configuration
variable if available. Fallback locations if _CS_DARWIN_USER_TEMP_DIR is not available are TMPDIR and /tmp. Care should be taken to ensure
that it is appropriate to use an environment variable potentially supplied by the user.
If no arguments are passed or if only the -d flag is passed mktemp behaves as if -t tmp was supplied.
Any number of temporary files may be created in a single invocation, including one based on the internal template resulting from the -t flag.
The mktemp utility is provided to allow shell scripts to safely use temporary files. Traditionally, many shell scripts take the name of the
program with the pid as a suffix and use that as a temporary file name. This kind of naming scheme is predictable and the race condition it
creates is easy for an attacker to win. A safer, though still inferior, approach is to make a temporary directory using the same naming
scheme. While this does allow one to guarantee that a temporary file will not be subverted, it still allows a simple denial of service
attack. For these reasons it is suggested that mktemp be used instead.
OPTIONS
The available options are as follows:
-d Make a directory instead of a file.
-q Fail silently if an error occurs. This is useful if a script does not want error output to go to standard error.
-t prefix
Generate a template (using the supplied prefix and TMPDIR if set) to create a filename template.
-u Operate in ``unsafe'' mode. The temp file will be unlinked before mktemp exits. This is slightly better than mktemp(3) but still
introduces a race condition. Use of this option is not encouraged.
EXIT STATUS
The mktemp utility exits 0 on success, and >0 if an error occurs.
EXAMPLES
The following sh(1) fragment illustrates a simple use of mktemp where the script should quit if it cannot get a safe temporary file.
tempfoo=`basename $0`
TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
echo "program output" >> $TMPFILE
To allow the use of $TMPDIR:
tempfoo=`basename $0`
TMPFILE=`mktemp -t ${tempfoo}` || exit 1
echo "program output" >> $TMPFILE
In this case, we want the script to catch the error itself.
tempfoo=`basename $0`
TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXX`
if [ $? -ne 0 ]; then
echo "$0: Can't create temp file, exiting..."
exit 1
fi
SEE ALSO
mkdtemp(3), mkstemp(3), mktemp(3), confstr(3), environ(7)
HISTORY
A mktemp utility appeared in OpenBSD 2.1. This implementation was written independently based on the OpenBSD man page, and first appeared in
FreeBSD 2.2.7. This man page is taken from OpenBSD.
BSD
December 30, 2005 BSD