Sponsored Content
Full Discussion: Always on the radar...
The Lounge What is on Your Mind? Always on the radar... Post 302965806 by bakunin on Wednesday 3rd of February 2016 09:27:22 AM
Old 02-03-2016
Quote:
Originally Posted by wisecracker
Well I got stuck on this:-
somesubstring=${somestring:x:y}
This variable expansion is IIRC only valid in ksh93, not in ksh88. In ksh88 you can do the following, though:

Code:
x="abcde"

while [ -n "$x" ] ; do
     first="${x%${x#?}}"
     rest="${x#?}"

     print - "first: $first    rest: $rest"

     x="$rest"
done

It is quite easy to build a substring-function around this.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
 

We Also Found This Discussion For You

1. Shell Programming and Scripting

save weather radar to local time-named file every 15 minutes

I think I can do this myself now, but I am always amazed by how people can do things cleaner and simpler than I end up doing... Using cron, I want to save the image found at: http://radar.weather.gov/ridge/Conus/RadarImg/centgrtlakes.gif every 15 minutes to a local file , such as ... (1 Reply)
Discussion started by: brucewestfall
1 Replies
rest(3alleg4)                                                     Allegro manual                                                     rest(3alleg4)

NAME
rest - Waits a specified number of milliseconds or yields CPU. Allegro game programming library. SYNOPSIS
#include <allegro.h> void rest(unsigned int time); DESCRIPTION
This function waits for the specified number of milliseconds. Passing 0 as parameter will not wait, but just yield. This can be useful in order to "play nice" with other processes. Other values will cause CPU time to be dropped on most platforms. This will look better to users, and also does things like saving battery power and making fans less noisy. Note that calling this inside your active game loop is a bad idea, as you never know when the OS will give you the CPU back, so you could end up missing the vertical retrace and skipping frames. On the other hand, on multitasking operating systems it is good form to give up the CPU for a while if you will not be using it. SEE ALSO
install_timer(3alleg4), rest_callback(3alleg4), vsync(3alleg4), d_yield_proc(3alleg4) Allegro version 4.4.2 rest(3alleg4)
All times are GMT -4. The time now is 04:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy