12-07-2017
Welcome
Othmane,
I have a few to questions pose in response first:-
- Is this homework/assignment? There are specific forums/rules for these.
- What have you tried so far?
- What output/errors do you get?
- What OS and version are you using?
- What are your preferred tools? (C, shell, perl, awk, etc.)
- What logical process have you considered? (to help steer us to follow what you are trying to achieve)
Most importantly,
What have you tried so far?
There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.
We're all here to learn and getting the relevant information will help us all.
Kind regards,
Robin
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Original Code Taken from here:
http://www.tldp.org/LDP/abs/html/bashver2.html#EX79
The code in the above link displays 4 unique 13 cards hands. I've modified it to deal a hand unique 2 card hand to 2 different players, then deal 5 unique community cards as in Texas Holdem (3 cards, then 1... (8 Replies)
Discussion started by: earnstaf
8 Replies
2. Shell Programming and Scripting
Hi All,
I want to create a shell script which dynamically create text files. i am using the following script
$i=1
while
do
cat > test_$i.txt
done
but while running the script it was stopping(the cursor not going to next step, i have to enter ctrl+c to make it stop). it is creating only... (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies
3. UNIX for Dummies Questions & Answers
Is there a textbased football game (American) that I can download through ubuntu server edition? (1 Reply)
Discussion started by: dadoprso
1 Replies
4. Shell Programming and Scripting
Okay so Zork sparked my interest in this. I have been learning to program for the last year and a half. I've dabbled in everything from Java to Ruby to PHP & XHTML & SQL, and now I'm on bash. I really like bash scripting. Its easy and fun. I just started two days ago. Pretty much I've been writing... (1 Reply)
Discussion started by: lemonoid
1 Replies
5. Shell Programming and Scripting
Okay so I'm making a simple text based game that branches into different scenarios. By branching I mean branching off into whole different files with that part of the game in it. I got tired of working on scenario 1 so I'm working on scenario 2. As I get started and try to test it, I get an... (3 Replies)
Discussion started by: lemonoid
3 Replies
6. UNIX for Dummies Questions & Answers
Hello, I am looking to make a text based game, that runs in the command window, or a window similar. I will only need to use 1 window.
I read somewhere that there is libraries for this kind of thing? But I can't remember the name of them.. Can anyone point me in a direction?
I will be... (2 Replies)
Discussion started by: murphy
2 Replies
7. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
I am required to create a bash shell script with either emacs or vi. It must include the year 2014 calendar on... (9 Replies)
Discussion started by: dandanhelpmeman
9 Replies
8. Shell Programming and Scripting
I need somebody who could help with an exercise.
You have a text file called users.txt with this info inside:
users.txt:
user1:1234:/home/homedir1 ;
user2:1234:/home/homedir2 ;
user3:1234:/home/homedir3 ;
user4:1234:/home/homedir4 ;
The script should create an user using the... (2 Replies)
Discussion started by: marcosruiz
2 Replies
9. Shell Programming and Scripting
GitHub - deepgrace/tetris: Tetris implementation in all kinds of Programming Languages
Usage: bash Tetris_Game ] ] ] ]
Range:
#!/bin/bash
# Tetris Game // The Art Of Shell Programming
box0=(4 30)
box1=(4 30 4 32)
box2=(4 30 5 32)
box3=(4 28 4 30 4 32)
box4=(4 28 4 30... (69 Replies)
Discussion started by: complex.invoke
69 Replies
10. Shell Programming and Scripting
When I run the following script at the bottom it say cards remaining=44...It should be=35.
Can anyone tell me what I'm doing wrong. I've spent hours trying to get this to work and I can't go any further until this part works. thank you in advance
Cogiz
#!/bin/bash
# Date="November, 2016"
#... (2 Replies)
Discussion started by: cogiz
2 Replies
lib(3pm) Perl Programmers Reference Guide lib(3pm)
NAME
lib - manipulate @INC at compile time
SYNOPSIS
use lib LIST;
no lib LIST;
DESCRIPTION
This is a small simple module which simplifies the manipulation of @INC at compile time.
It is typically used to add extra directories to perl's search path so that later "use" or "require" statements will find modules which are
not located on perl's default search path.
Adding directories to @INC
The parameters to "use lib" are added to the start of the perl search path. Saying
use lib LIST;
is almost the same as saying
BEGIN { unshift(@INC, LIST) }
For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so
the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is added to @INC in front of $dir.
lib.pm also checks if directories called $dir/$version and $dir/$version/$archname exist and adds these directories to @INC.
The current value of $archname can be found with this command:
perl -V:archname
The corresponding command to get the current value of $version is:
perl -V:version
To avoid memory leaks, all trailing duplicate entries in @INC are removed.
Deleting directories from @INC
You should normally only add directories to @INC. If you need to delete directories from @INC take care to only delete those which you
added yourself or which you are certain are not needed by other modules in your script. Other modules may have added directories which
they need for correct operation.
The "no lib" statement deletes all instances of each named directory from @INC.
For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so
the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is also deleted from @INC.
Restoring original @INC
When the lib module is first loaded it records the current value of @INC in an array @lib::ORIG_INC. To restore @INC to that value you can
say
@INC = @lib::ORIG_INC;
CAVEATS
In order to keep lib.pm small and simple, it only works with Unix filepaths. This doesn't mean it only works on Unix, but non-Unix users
must first translate their file paths to Unix conventions.
# VMS users wanting to put [.stuff.moo] into
# their @INC would write
use lib 'stuff/moo';
NOTES
In the future, this module will likely use File::Spec for determining paths, as it does now for Mac OS (where Unix-style or Mac-style paths
work, and Unix-style paths are converted properly to Mac-style paths before being added to @INC).
If you try to add a file to @INC as follows:
use lib 'this_is_a_file.txt';
"lib" will warn about this. The sole exceptions are files with the ".par" extension which are intended to be used as libraries.
SEE ALSO
FindBin - optional module which deals with paths relative to the source file.
PAR - optional module which can treat ".par" files as Perl libraries.
AUTHOR
Tim Bunce, 2nd June 1995.
"lib" is maintained by the perl5-porters. Please direct any questions to the canonical mailing list. Anything that is applicable to the
CPAN release can be sent to its maintainer, though.
Maintainer: The Perl5-Porters <perl5-porters@perl.org>
Maintainer of the CPAN release: Steffen Mueller <smueller@cpan.org>
COPYRIGHT AND LICENSE
This package has been part of the perl core since perl 5.001. It has been released separately to CPAN so older installations can benefit
from bug fixes.
This package has the same copyright and license as the perl core.
perl v5.18.2 2017-10-07 lib(3pm)