Programming :: Getting Perl Simple Recursive Sub?

Feb 16, 2011

This is my sub;

Code:

sub projName
{
print "Enter project name: " ;
$PROJ = <STDIN>;
print "";

[code]....

I can call this routine and it works fine when I enter a valid name for $PROJ. If I enter an invalid name it goes to the else block and prints the statement. However, it does not call itself. Instead the script just exits.I've googled 'perl recursive subroutines' and the example don't appear to be doing anything different.

View 4 Replies


ADVERTISEMENT

Programming :: Simple Header For Perl Programs?

Nov 5, 2010

i am trying to do something very simple like a header and a footer for my first perl programs, what iam trying to do is that when i create a file in vim: lets say hello.pl , i would like that file to have already this in its header:

#!/usr/bin/perl
and this on the footer:
print "
";

so that i dont have to type everytime #!/usr etc i tried to do it this way but i get weird vim errors: header is a file that contains the header and footer $ vim hello.pl;header > is there another way to do it as a function in bash or some other one liner command?

View 1 Replies View Related

Programming :: Simple Perl Log Code Not Working?

May 25, 2010

I just upgraded servers, and I'm now on 'perl v5.8.8 built for i386-linux-thread-multi' and a simple log script doesn't work. I got it changed to

Code:
#!/usr/bin/perl
use strict;

[code]....

View 4 Replies View Related

Programming :: Error/warning Message S From For Simple Perl Script

Mar 17, 2010

I just wrote a simple perl script to compare the following two files

[Code]...

View 7 Replies View Related

General :: Finding A Recursive Shell Or Perl Script To Delete Files With The Same Name As The Parent Folder?

Jun 29, 2010

is there a recursive shell or Perl script to delete files with the same name as the parent folder? i wish to include the starting folder name as argument to the script.

View 2 Replies View Related

Programming :: How To Compile / Simple Tutorial For Making Simple Program

Oct 7, 2010

i'm a college student studying pc programing, and i was given today a special work and i have to program using miranda... which i've never used it >.< can anyone give me a hand to where to download, how to compile, and a simple tutorial for making a simple program or something?

View 3 Replies View Related

Programming :: Recursive Search In A Tar.bz2 File?

Jul 14, 2011

I am looking for a one liner to search for a string in file(s) which are in a tar ball (.tar.bz2 in my case)

Code:
-bash-3.2$ tar -tjf /var/log/ABC/07142011-1412.tar.bz2
var/log/ABC/07142011-1412/
var/log/ABC/07142011-1412/live_hosts.txt
var/log/ABC/07142011-1412/all_hosts.txt
var/log/ABC/07142011-1412/LOGS.txt

How can I recursively look inside all the txt files in this tar file ?

View 10 Replies View Related

Programming :: SH - Recursive Variable Substitution

Jul 1, 2010

I have the following test code fragment:

Code:

When I try to run it 'sh' reports the following message^

Code:

You might understand what I mean with that test code so could you recommend how to achieve the required effect?

View 7 Replies View Related

Programming :: Set A Recursive Function As Inline?

Feb 3, 2011

Is it good to set a recursive function as inline? I would think it would increase the performance speed of the program.

View 2 Replies View Related

Programming :: Make Recursive Makefile Work?

Jun 8, 2011

I'm trying to make recursive makefile work but it's giving me two problems. I have a top folder with the main Makefile and one Makefile for each sub folder 'one' and 'two'. Makefile in subfolder 'one' and 'two' are identical. The top Makefile (still a bit messy) looking like this:

Code:
# Directories
CC = gcc
CFLAGS = -Wall -Wextra
TARGET_DIR = bin
MAIN_FILE = one.c

[Code]...

View 4 Replies View Related

Programming :: Compiling Recursive Makefile In Directory Structure

May 18, 2011

I'm having problems with compiling recursive Makefiles in my directory structure:
My folder layout is:
top/|- one/|- one.c (With main function)|- zero.c|- two/|- two.cin my top folder the make file looks like:

Code:
MAKE_DIRECTORIES = one two
.PHONY: all
all: $(MAKE_DIRECTORIES)

.PHONY: $(MAKE_DIRECTORIES)
$(MAKE_DIRECTORIES):
@echo $@
$(MAKE) --directory=$@
in my one and two folder I have the following Makefile:

Code:
.PHONE: all
all:
@echo $@
$(CC) $(CFLAGS) *.c
But when I compile it from top folder: make

I get following output:
Code:
one
two
Which states that directory statement by echo in main Makefile is ok but the files are not compiled in one and two.

View 5 Replies View Related

Programming :: Multi File Recursive Folder Search And Replace?

Aug 3, 2010

I'm wanting to mod some PHP files across a hierarchy and thought I'd drive it with find + grep + xargs

I built up a command line which I was confident would do the job, but now can't save the results.

First I tried this:

Code:
find . -name *.php | xargs grep serialize | cut -d: -f1| sort -u | xargs sed -i s/serialize/serialise/g
but that didn't work:
Code:
sed: illegal option -- i
so I thought I'd try using
Code:

[Code].....

View 10 Replies View Related

Programming :: Test Permissions On All Files / Folders Into A Folder Recursive?

May 16, 2010

Way to test permissions on all files/folders into a folder recursive, then if those are not user:user then do :

Code:
chown user:user thatconcernedfile

The problem with that

Code:
chown user:user -R /folder

is that it is doing changes on file permissions whihch are already ok. If you wanna maintain a specific permission on a folder this is really not good this :

Code:
while [ 1 ] ; do
chown user:user -R /folder
# /folder contains 6.0 Tb
sleep 2s
done

View 1 Replies View Related

Programming :: Bash - Recursive Find - Create Parent Folder - Moving File

Dec 5, 2010

I'm starting bash shell script and I'm looping without any solution.

I'm trying to find some files under a folder hierarchy and in case of errors moving these files to a destination folder under the same hierarchy recreating this hierarchy if not exists.

Finding all ._* files under /src and moving them to /dest recreating folder1 or the others which contains ._* files but without moving files which does not correspond to the pattern.

Code:

I tried find command and I'am getting all needed files

Code:

But I don't know how to use the output to get the parent folder of files which are found to

1- create folder with mkdir -p /dest/folder1 or /dest/folder1/folder4

2- move found files from /src/... to /dest/... with rm command

I'm working on a find command as this trying to do all in the same line but ... little lost

Code:

View 8 Replies View Related

Programming :: C++ Programming With Simple RTAI Functions Outputing Words?

Apr 11, 2011

I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.

1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".

2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.

Quote:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!

[Code]...

View 3 Replies View Related

Programming :: Build A Simple Program For C Programming Class?

Feb 12, 2011

im trying to build a simple program for my C programming class, this is the source code

#include <stdio.h>
int main()
{
int length, width, length, height, area, perimeter;
perimeter = width + length + height;
area = width * length + heigth;

[Code]...

i dont see any error (you might)but every time i run it it runs but after it asks me to input for the width i do it but it doesn't take me to the length, it just stays blank until i input another value in the same place for the width, it asks me for 4 inputs in total i don;t know why, and after i run it different times it gives me different values for the perimeter and are. how can I fix this?

View 5 Replies View Related

Programming :: Socket Programming In Module Perl

Jul 21, 2010

Where is the perl module for programming with sockets?

View 4 Replies View Related

Programming :: Create A Simple Makefile Using C ?

Mar 26, 2011

How to create a simple Makefile using C....

View 3 Replies View Related

Programming :: Simple If's In Bash Scripts?

Nov 7, 2010

I have been looking at: ut a lot of it is to do with files and numerical comparisonswhat would be the bash equivalent of:if (http isin $2) { do something }

View 2 Replies View Related

Programming :: Simple Subtraction Using Bash And Bc

Nov 4, 2009

I am trying to create a function that takes a pair of a high and a low limit, and returns an arbitrary number between them. Below is my attempt to create a function that accomplishes this by checking to see if they are equal, and if not, subtracts a very small number from the high limit and returns the result.

View 2 Replies View Related

Programming :: Get Started With Making 'a SIMPLE Dock'?

Mar 22, 2011

This is probably hopelessly ambitious as I'm not a C or C++ programmer (I normally like to stick to scripting languages like BASH or Perl). Basically I'm looking on good advice to get me started with writing a Application Dock with the functionality of the OSX dock but without the overly flamboyant graphics that have characterised the Linux versions.At the moment the closest I've found to what I would like is bbdock. However it falls well short of the functionality of what I would like.

What bbdock does is read a file to create an icon for the openbox dock/fluxbox slit/wmaker whatever that launches an application when first clicked, shows an little arrow when the application is running, and brings the application to the fore when clicked once running.Here's a screenshot of it doing just that.The drawback to bbdock is that it doesn't really look for running applications, only those launched from bbdock. So for example it wont notice if I've launched an instance of pcmanfm from the openbox menu. And therefore it obviously also doesn't add icons for other applications that are running.

What I would like to be able to do is detect new running applications and add a bbdock icon for them. Also to detect if an application already with a shortcut has been run and update it's status to show it's open. Probably have an up and down arrow to move the icons up and down when there are too many to fit on the screen. None of the above needs fancy animation. The fade to gray effect used by bbdock is quite nice and could probably be augmented with a fade in and out to grey to represent another action, say fading to grey and back when launching and greyed when iconified.So, my question is what do I need to get started doing this? Am I best using the pretty outdated bbdock wmaker dockapp style? What functions and libraries am I likely to need to achieve the effects I want? Are there any examples of how to monitor running applications (well windows and figure out what constitutes a new application) that I could look at for inspiration. Is there anyone who's into C++ for linux who would be interested in helping me out to get this small project working?

View 8 Replies View Related

Programming :: Simple Script For Comparing Two Directories?

Apr 1, 2011

have a simple script for comparing two directories. I want to list all differences between this directories.

here is my function for compare:

function comp
{
for i in $1/*; do
if [ ! -e "$2/${i##*/}" ]; then
echo $i

[Code]....

in my script these two files are equal(my script ignored last time modified)

View 5 Replies View Related

Programming :: Creating Simple Webcam Effects?

Apr 13, 2010

I want to create simple webcam effects filters. I am only interested in doing relatively simple image processing like blurring or averaging the color. I would like to create the filters in either C or Python.

So before I dive into using Gstreamer or V4L I wanted to ask the forum if they have had any experience with webcam development?

View 2 Replies View Related

Programming :: Python: Simple Message Queues / IPC?

Mar 10, 2010

I have this daemon I'm writing in Python, but I still a Python n00b. I've coded the part of the daemon that does the work, but not the part that receives messages. I need a simple system so that other processes on the same (Linux) computer can occasionally send text-string messages to the daemon (without needing to stay running all the time themselves). Once in the past we did something similar by (mis)using pyliblo to listen for OSC messages coming in on a certain port. That option isn't as workable here because the pyliblo interface (as near as I can tell) requires you to know in advance specifically what messages you are expecting, and forward them to specified functions, rather than just allowing you to generically process incoming messages as you see fit.

View 1 Replies View Related

Programming :: Reading A Simple File Format In C?

Dec 16, 2010

I made a string key-value mapping struct in C, and functions to add and remove entries. I would also like to write a function to read in this file format:

Code:
key: value
another: another value

[code]...

View 14 Replies View Related

Programming :: Simple C# Using Mono Not Working Properly?

May 13, 2010

I am creating a simple program using C# to print the contents of the todo.txt file once it has run. Problem is when I run the program, I get this warning.

PHP Code:

[code]....

View 12 Replies View Related

Programming :: How To Write Simple C Program In RHEL5

Sep 17, 2010

How can i write a simple c program in my RHEL5?I am more concerned about what are toosl i need to install to get a C platfrom running in my RHEL5?

View 14 Replies View Related

Programming :: Use PIL In Python To Simple Composite Images

Jun 24, 2010

I have a render script that uses several Blender 3D instances on several machines to co-render one still image. The image is split into squares of 64 x 64 pixels. In the end, I have like 200 image files, each one with a puzzle piece of the whole.

Now I would like to assembe these pieces into whole with PIL and Python, but so far cannot figure out how. I am new to PIL, but in imagemagick, a convert image1.png image2.png image3.png +append finalimage.png works a charme. But convert chokes on so many image files, so I need something automatic and scalable. I think that pictures are RGBA, so black should be the alpha channel and transparent.

I think I have to mention that the pieces are in the right position and that every piece has the original dimensions of the full picture, so it is not a problem figuring out where each piece should be. Just putting all the pictures on top of eachother and ignoring anything that is black would do the trick nicely.

How can I reach this with PIL? Which functions do I need for that? PIL does a lot of stuff, so finding my simple function is daunting.

View 1 Replies View Related

Programming :: Simple Download Scheduler Program Code?

Apr 30, 2010

I have created a simple download schedular with source-code give below :

---------------------record_strokes.sh-------------------
touch /home/student/packs/lynx/logfile
lynx -cmd_log /home/student/packs/lynx/logfile

[code]....

View 10 Replies View Related

Programming :: Simple Bash Script Is Not Running All Of The Commands?

Jun 14, 2010

I am running a simple script that I copied from slug.ceca.utc.edu/docs/2009-3-26-linux-server-health.pdf and edited with the names and paths of my own servers. I don't know much about scripting (re: nothing) but I wanted to try and be efficient in my new role as a Linux Sys Admin. The script was saved to root's home directory and runs as part of root's crontab once a week. The script runs with no problem, but it doesn't actually seem to run all of the commands contained within. It skips some in the middle and the end and I don't know why. The script itself is this:

Code:
#!/in/bash
uname -a > /tmp/server.txt

[code]...

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved