Sponsored Content
Full Discussion: What was wrong ??? ksh
Top Forums Shell Programming and Scripting What was wrong ??? ksh Post 99818 by DogDay on Tuesday 21st of February 2006 07:50:33 PM
Old 02-21-2006
No it has to do with the pipe "|" symbols in the strings.

It is confusing the test. I don't know a way around it though. I've tried it myself with double quotes and single quotes around the strings but it still fails.

Perhaps perl is capable or there is a test in ksh I am just not aware of.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies

2. Programming

What am I doing wrong!!!

Hi all, I'm just getting back in to C programming after some time and I thought I would start off with a simple XOR encryption program. However I'm having trouble getting it to work. The code in prompt() function works great when it is just placed in side of main() however I want to be able to... (5 Replies)
Discussion started by: WelshDave
5 Replies

3. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

4. UNIX for Dummies Questions & Answers

Difference Between executing llike ./myscript.ksh and . ./myscript.ksh

Hi , What is the diffence between executing the script like ./myscript.ksh . ./myscript.ksh I have found 2 difference but could not find the reason 1. If i export a variable in myscript.ksh and execute it like . ./myscript.ksh the i can access the other scripts that are present in... (5 Replies)
Discussion started by: max_hammer
5 Replies

5. UNIX for Advanced & Expert Users

What am I doing wrong here?

I am working on a simple login ID check shell script that should prompt for a user ID then check to see if this user is logged on. Trying to get the hang of this stuff so I am thinking of my own little projects. #! /bin/sh echo "please enter a user name" read user if user=$user then... (3 Replies)
Discussion started by: jsk319342
3 Replies

6. Shell Programming and Scripting

syntax of if condition in ksh is wrong

The syntax of 'if' conditionals in bash and ksh seems different. I am trying to check for a particular version using 'if' in ksh. This very simple syntax gives syntax error. I have tried many variants, but no go. Please correct the syntax. Later I will expand it to 'if' and 'else'. #!/bin/ksh... (8 Replies)
Discussion started by: nivedhitha
8 Replies

7. UNIX for Dummies Questions & Answers

[Solved] ksh script - can't figure out what's wrong

Hi! (I guess this could of gone into the scripting forum, but Unix for Dummies seemed more appropriate. Please note that I am not in school, so Homework doesn't seem appropriate either. You guys can let me know if you think otherwise.) I am following an exercise in a book on ksh scripting which... (2 Replies)
Discussion started by: sudon't
2 Replies

8. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

9. Shell Programming and Scripting

Can anyone tell me what's wrong here...

Here is my code.... just want to compare column 1 and 2 of file 2 with file 1 as standard file and print file 2 all contents with matched index value stored in $8 of file 1 awk 'NR==FNR{ A=$0;B++;next} {print A?$0 FS B: $0 FS "Not-Found" }' FS="\t" file1 file2 here B is not printing if... (19 Replies)
Discussion started by: Akshay Hegde
19 Replies

10. Shell Programming and Scripting

Number comparison in ksh on mac with -lt is giving wrong answer

I am trying to run following script in ksh on darwin 11.4.2: freeSpace=2469606195 spaceNeeded=200 ] && echo "no space" || echo "space available" ] && echo "no space" || echo "space available" "-lt" is giving wrong answer as "no space" Whereas '<' works fine. When I change the freespace... (4 Replies)
Discussion started by: sabitha
4 Replies
Test::utf8(3pm) 					User Contributed Perl Documentation					   Test::utf8(3pm)

NAME
Test::utf8 - handy utf8 tests SYNOPSIS
# check the string is good is_valid_string($string); # check the string is valid is_sane_utf8($string); # check not double encoded # check the string has certain attributes is_flagged_utf8($string1); # has utf8 flag set is_within_ascii($string2); # only has ascii chars in it isnt_within_ascii($string3); # has chars outside the ascii range is_within_latin_1($string4); # only has latin-1 chars in it isnt_within_ascii($string5); # has chars outside the latin-1 range DESCRIPTION
This module is a collection of tests useful for dealing with utf8 strings in Perl. This module has two types of tests: The validity tests check if a string is valid and not corrupt, whereas the characteristics tests will check that string has a given set of characteristics. Validity Tests is_valid_string($string, $testname) Checks if the string is "valid", i.e. this passes and returns true unless the internal utf8 flag hasn't been set on scalar that isn't made up of a valid utf-8 byte sequence. This should never happen and, in theory, this test should always pass. Unless you (or a module you use) goes monkeying around inside a scalar using Encode's private functions or XS code you shouldn't ever end up in a situation where you've got a corrupt scalar. But if you do, and you do, then this function should help you detect the problem. To be clear, here's an example of the error case this can detect: my $mark = "Mark"; my $leon = "Lx{e9}on"; is_valid_string($mark); # passes, not utf-8 is_valid_string($leon); # passes, not utf-8 my $iloveny = "I x{2665} NY"; is_valid_string($iloveny); # passes, proper utf-8 my $acme = "Lx{c3}x{a9}on"; Encode::_utf8_on($acme); # (please don't do things like this) is_valid_string($acme); # passes, proper utf-8 byte sequence upgraded Encode::_utf8_on($leon); # (this is why you don't do things like this) is_valid_string($leon); # fails! the byte x{e9} isn't valid utf-8 is_sane_utf8($string, $name) This test fails if the string contains something that looks like it might be dodgy utf8, i.e. containing something that looks like the multi-byte sequence for a latin-1 character but perl hasn't been instructed to treat as such. Strings that are not utf8 always automatically pass. Some examples may help: # This will pass as it's a normal latin-1 string is_sane_utf8("Hello Lx{e9}eon"); # this will fail because the x{c3}x{a9} looks like the # utf8 byte sequence for e-acute my $string = "Hello Lx{c3}x{a9}on"; is_sane_utf8($string); # this will pass because the utf8 is correctly interpreted as utf8 Encode::_utf8_on($string) is_sane_utf8($string); Obviously this isn't a hundred percent reliable. The edge case where this will fail is where you have "x{c2}" (which is "LATIN CAPITAL LETTER WITH CIRCUMFLEX") or "x{c3}" (which is "LATIN CAPITAL LETTER WITH TILDE") followed by one of the latin-1 punctuation symbols. # a capital letter A with tilde surrounded by smart quotes # this will fail because it'll see the "x{c2}x{94}" and think # it's actually the utf8 sequence for the end smart quote is_sane_utf8("x{93}x{c2}x{94}"); However, since this hardly comes up this test is reasonably reliable in most cases. Still, care should be applied in cases where dynamic data is placed next to latin-1 punctuation to avoid false negatives. There exists two situations to cause this test to fail; The string contains utf8 byte sequences and the string hasn't been flagged as utf8 (this normally means that you got it from an external source like a C library; When Perl needs to store a string internally as utf8 it does it's own encoding and flagging transparently) or a utf8 flagged string contains byte sequences that when translated to characters themselves look like a utf8 byte sequence. The test diagnostics tells you which is the case. String Characteristic Tests These routines allow you to check the range of characters in a string. Note that these routines are blind to the actual encoding perl internally uses to store the characters, they just check if the string contains only characters that can be represented in the named encoding: is_within_ascii Tests that a string only contains characters that are in the ASCII charecter set. is_within_latin_1 Tests that a string only contains characters that are in latin-1. Simply check if a scalar is or isn't flagged as utf8 by perl's internals: is_flagged_utf8($string, $name) Passes if the string is flagged by perl's internals as utf8, fails if it's not. isnt_flagged_utf8($string,$name) The opposite of "is_flagged_utf8", passes if and only if the string isn't flagged as utf8 by perl's internals. Note: you can refer to this function as "isn't_flagged_utf8" if you really want to. AUTHOR
Written by Mark Fowler mark@twoshortplanks.com COPYRIGHT
Copyright Mark Fowler 2004,2012. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. BUGS
None known. Please report any to me via the CPAN RT system. See http://rt.cpan.org/ for more details. SEE ALSO
Test::DoubleEncodedEntities for testing for double encoded HTML entities. perl v5.14.2 2012-02-18 Test::utf8(3pm)
All times are GMT -4. The time now is 08:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy