Sponsored Content
Full Discussion: POSIX compliance...
Operating Systems OS X (Apple) POSIX compliance... Post 302976772 by wisecracker on Wednesday 6th of July 2016 05:09:51 AM
Old 07-06-2016
Apologies for any typos...
Quote:
Originally Posted by Scrutinizer
Hi Barry,

That looks quite neat and Posixy!

Some comments and ideas:
  • The sleep command is not used in a POSIX compliant ways, since it gets fed a float here, and in POSIX it can only handle integers. An alternative is maybe to fill the hourglass more or less from the start, depending on the number of minutes / seconds, and compensate the rest with the first sleep command.
  • Instead of using awk to cut the first 6 characters you could use "${platform%"${platform#??????}"}" or better yet, replace the if statements with one case statement and use it pattern matching capability CYGWIN*), so you do not need to cut the platform string.
  • The awk command substitutions in the 2nd for loop take time and will skew the time slightly. An alternative is to use parameter expansions or predefine the strings so that it does not add as much to the time used by the sleep commands..
  • Perhaps you could have a seconds countdown instead of the static number.
  • If more time is entered than what the hourglass can handle, graphically turn the hourglass (nice scripting challenge?)
Thank you for these comments. I was half expecting to be slated... ;oD

I did check the auxiliary programs sleep and awk but could find nothing definite to tell me what was the current POSIX position for these.

I had lines similar to these:-
Code:
#!/bin/sh
text="1234567890"
char=$( cut -c2-6 <<< "$text" )
printf "%s" "${text:1:5}"
echo "$char"

Code:
$ shellcheck myscript
 
Line 3:
char=$( cut -c2-6 <<< "$text" )
                      ^-- SC2039: In POSIX sh, here-strings are undefined.
 
Line 4:
printf "%s" "${text:1:5}"
             ^-- SC2039: In POSIX sh, string indexing is undefined.

$ _

These really threw me and constant searching gave me the results inside the main code.
I could not find your "${platform%"${platform#??????}"}" anywhere, perhaps it was my search phrases but I spent hours trying to find non-time consuming methods without much success. Many thanks for those snippets.
I never even thought about using pettern matching, maybe because being an amateur I think differently to pros.

I was giong to use the "afplay", "aplay" and "/dev/dsp" as timers, (I will let you think about that one ;o) ), but decided against it as these are platform specific and would require some serious experimentation.

However I was aware of timings but that was not too important to me as learning POSIX requirements was; and guys like you supplying info helps others, (and judging by the posts on here, possibly tens of thousands of them), to steer through this quagmire too.

Again thanks, makes me feel good... ;o)

EDIT:
I forgot to add:- The rotating hourglass idea using ASCII - OUCH, but as you say a real challenge to draw at 45 degrees per movement... ;oO

Last edited by wisecracker; 07-06-2016 at 06:21 AM.. Reason: Rotating hourglass.
 

5 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sudo & Sox compliance

Hello, I am trying to convince my boss to stop allowing our users to login as root (superuser). Currently our users login to our unix server with their own account, then as needed, they will do an su and put in the root password. This scares me, for a bunch of reasons. Mainly, one is that we... (1 Reply)
Discussion started by: rwallaceisg
1 Replies

2. UNIX for Dummies Questions & Answers

man synopsis standard compliance

In different online sources, I found bits and pieces of information about those square and angular brackets and pipes. From what I have read, I can conclude it looks like this: 1. Options outside any brackets are mandatory 2. Options inside these < .. > are mandatory too 3. Options inside ... (4 Replies)
Discussion started by: vkleban
4 Replies

3. Cybersecurity

PCI DSS Compliance : Insecure Communication Has Been Detected

From the nessus scanner tool report i got below vulnerability PCI DSS Compliance : Insecure Communication Has Been Detected http://www.tenable.com/plugins/index.php?view=single&id=56208 As per the description given in above link - I am not able to understand How to find insecure port... (2 Replies)
Discussion started by: saurabh84g
2 Replies

4. Red Hat

Looking for PCI Compliance tool for Redhat Lix.

Hi i am in new to Linux world . I have been assigned to a project to find out a tool that will fulfill the PCI compliance for Linux servers for Audit process. anyone have any recommendation on that. Do Rad hat have any native application or plug-ins which we can use for that. (1 Reply)
Discussion started by: sahasuman
1 Replies

5. HP-UX

Password compliance setting

I need to set password compliance for some servers in my company. However, the requirements are that we need to set different password policies for 3 different user groups within the company. These are : System Users: i.e root, etc Batch/Application Users: oracle, bscs, etc Standard User:... (0 Replies)
Discussion started by: anaigini45
0 Replies
All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy