04-10-2008
Watch the brackets. It's not "( )", but "[ ]"
It's not elsif. It should be elif or else if
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Situation: I have a working shell script on our file server (OSXS Tiger) to connect to a workstation, which is using a portable home directory (phd), and rsync a user's MirrorAgent.log. I'm not that strong of a scripter (obviously), but I would like to add other workstations to this script as they... (4 Replies)
Discussion started by: le0pard13
4 Replies
2. Shell Programming and Scripting
Hi guys
I tried to convert this c++ code to c shell script but there are some bugs and I don't know how to solve it.
This code prints the three variables in decreasing order:
int main()
{
int x,y,z;
cin >> x >> y >>z;
if ( x < y )
if ( x < z )
if ( y < z )
cout << x <<" " <<... (2 Replies)
Discussion started by: domain
2 Replies
3. Shell Programming and Scripting
perl script:
my $logdir = '/smp/dyn/logfiles/fsm/mp/mp';
$logdir = $logdir ."/mp${toDate}*";
i tried to make it..as below .. but not working ..
date +%m%d%y
logdir = /smp/dyn/logfiles/fsm/mp/mp
logdir=$logdir/mp"$date"
but it was not working.....
can someone please help me out in... (1 Reply)
Discussion started by: mail2sant
1 Replies
4. Shell Programming and Scripting
hi experts,
how will i convert the first part of my script into expect or tcl since shell script cannot be embedded into expect script ? i have 100+ servers in my serverlist. how will i call or declare it in expect or tcl ?
#!/usr/sbin/expect -f
serverlist=`cat $1`
for i in serverlist... (2 Replies)
Discussion started by: linuxgeek
2 Replies
5. Shell Programming and Scripting
I have a shell script which I made with the help of this forum
#!/bin/sh
RuleNum=$1
cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}'
Basically I have a pages after pages of bandwidth rules and the script gives... (0 Replies)
Discussion started by: sb245
0 Replies
6. Red Hat
Dear!
I've a script (vbscript) running on windows machine for along time ago. 2 weeks ago, we changed server from Windows to RHEL5, and this script did not run, and I'm not programmer. So that, I post this script here and wish you convert for me.
vbscript code:
'This script will:
' - ZIP... (1 Reply)
Discussion started by: trantuananh24hg
1 Replies
7. Shell Programming and Scripting
Hi is there a way that i can convert this simple perl program into shell script
#!usr/bin/perl -w
use strict;
use warnings;
open INPUTFILE, "uniqprobecoordinates.out" || die "canot open the file $!";
open OUTPUTFILE, ">", "1_4reads.out";
while(<INPUTFILE>)
{
chomp;
... (3 Replies)
Discussion started by: bhargavpbk88
3 Replies
8. Shell Programming and Scripting
how to convert these code to shell script
#include<stdio.h>
#include<conio.h>
main()
{
int
i,j,a=0,b=0,c=0,f,t,al,ta;
int a1, max, n, n1,p,k=0;
printf(“\n enter no.of resources”);
scanf(“%d”,n1);
printf(“\nenter the max no .of resources for each type”);
for(i=0;i<n1;i++)... (4 Replies)
Discussion started by: syah
4 Replies
9. Shell Programming and Scripting
Hello,,I have a very small script that contains these lines; and it works perfectly; however I need to use Perl now as I will need to feel variables from a MySQL table into this; to it would be nice to start by converting this first...
find / -perm 777 \( -type f -o -type d \) -exec ls -lid {}... (1 Reply)
Discussion started by: gvolpini
1 Replies
10. Shell Programming and Scripting
I had try to create a basic shell script. So now im trying to convert in to C-programming language can some one guide/help me out with it?(BTW IM USING A LINUX/UNIX/ORACLE SYSTEM) CODE BELOW
!/bin/bash
for i in `ls -1 /cslab/home/JAZEL/`
do
cp -uv $i /cslab/home/JAZEL/cs295/$i.`date... (2 Replies)
Discussion started by: Nygenesis
2 Replies
LEARN ABOUT DEBIAN
sdl::cookbook::opengl
pods::SDL::Cookbook::OpenGL(3pm) User Contributed Perl Documentation pods::SDL::Cookbook::OpenGL(3pm)
NAME
SDL::Cookbook::OpenGL - Using SDL with OpenGL
CATEGORY
Cookbook
DESCRIPTION
As of release 2.5 SDL no longer maintains it's own bindings of OpenGL. Support for OpenGL has been moved over to a more mature
implementation.
This implementation is the POGL project. OpenGL is faster and more complete; and works with SDL seamlessly.
EXAMPLE
Expanded from Floyd-ATC's OpenGL example.
use strict;
use warnings;
use SDL;
use SDLx::App;
use SDL::Mouse;
use SDL::Video;
use SDL::Events;
use SDL::Event;
use OpenGL qw(:all);
You can use OpenGL as needed here.
my ($SDLAPP, $WIDTH, $HEIGHT, $SDLEVENT);
$| = 1;
$WIDTH = 1024;
$HEIGHT = 768;
$SDLAPP = SDLx::App->new(title => "OpenGL App", width => $WIDTH, height => $HEIGHT, gl => 1);
$SDLEVENT = SDL::Event->new;
SDLx::App can start an OpenGL application with the parameter gl => 1.
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(60, $WIDTH / $HEIGHT, 1, 1000);
glTranslatef(0, 0, -20);
Above we enable GL and set the correct perspective
while(1) {
&handlepolls;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glRotatef(.1, 1, 1, 1);
&drawscene;
$SDLAPP->sync;
}
For SDLx::App sync handles the GL buffer clean.
sub drawscene {
my ($color, $x, $y, $z);
for (-2 .. 2) {
glPushMatrix;
glTranslatef($_ * 3, 0, 0);
glColor3d(1, 0, 0);
&draw_cube;
glPopMatrix;
}
return "";
}
sub draw_cube {
my (@indices, @vertices, $face, $vertex, $index, $coords);
@indices = qw(4 5 6 7 1 2 6 5 0 1 5 4
0 3 2 1 0 4 7 3 2 3 7 6);
@vertices = ([-1, -1, -1], [ 1, -1, -1],
[ 1, 1, -1], [-1, 1, -1],
[-1, -1, 1], [ 1, -1, 1],
[ 1, 1, 1], [-1, 1, 1]);
glBegin(GL_QUADS);
foreach my $face (0..5) {
foreach my $vertex (0..3) {
$index = $indices[4 * $face + $vertex];
$coords = $vertices[$index];
glVertex3d(@$coords);
}
}
glEnd;
return "";
}
Below we can use SDL::Events as normal:
sub handlepolls {
my ($type, $key);
SDL::Events::pump_events();
while (SDL::Events::poll_event($SDLEVENT)) {
$type = $SDLEVENT->type();
$key = ($type == 2 or $type == 3) ? $SDLEVENT->key_sym : "";
if ($type == 4) { printf("You moved the mouse! x=%s y=%s xrel=%s yrel=%s
", $SDLEVENT->motion_x, $SDLEVENT->motion_y, $SDLEVENT->motion_xrel, $SDLEVENT->motion_yrel) }
elsif ($type == 2) { print "You are pressing $key
" }
elsif ($type == 3) { print "You released $key
" }
elsif ($type == 12) { exit }
else { print "TYPE $type UNKNOWN!
" }
if ($type == 2) {
if ($key eq "q" or $key eq "escape") { exit }
}
}
return "";
}
SEE ALSO
perl SDLx::App OpenGL
AUTHORS
See "AUTHORS" in SDL.
perl v5.14.2 2012-05-28 pods::SDL::Cookbook::OpenGL(3pm)