Cool script. As others have noted echo varies to much across implementations (even within bash), use the sure-fire portable printf instead to make your script more reliable.
If you run this on your code:
Then it should replace problematic echo -e with printf and then it gives visible output on OSX too. But one problem remaining is that not all signal traps are supported on every OS (for example signal 34):
On OSX from bash:
On Linux from bash:
Last edited by Scrutinizer; 03-12-2012 at 06:20 AM..
This User Gave Thanks to Scrutinizer For This Post:
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)
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)
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)
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)
Hi All,
Been trying to understand the code in tetris game (in the sticky threads) & i know i have a alot reading /practice to do. it's using advanced methods with arrays and arithmetic and would much appreciate if some one can guide me to good books that's not outdated that would help me take... (0 Replies)
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)
Hello guys I'm new to shell scripting and I need to make a game using shell script. I want to know if it is possible for me a total noob to shell scripting to make this game.
The game concept is simple:
First thing when you launch the script you get a menu in which you select if you want to... (3 Replies)
Discussion started by: Othmane
3 Replies
LEARN ABOUT OSF1
pthread_kill
pthread_kill(3) Library Functions Manual pthread_kill(3)NAME
pthread_kill - Delivers a signal to a specified thread. (This routine is available only on a UNIX system.)
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h> #include <signal.h>
int pthread_kill(
pthread_t thread,
int sig);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
PARAMETERS
Thread to receive a signal request. A signal request.
DESCRIPTION
This routine sends a signal to the specified target thread thread. Any signal defined to stop, continue, or terminate will stop or termi-
nate the process, even though it can be handled by the thread. For example, SIGTERM terminates all threads in the process, even though it
can be handled by the target thread.
Specifying a sig argument of zero (0) causes this routine to validate the thread argument but not to deliver any signal.
The name of the "kill" routine is sometimes misleading, because many signals do not terminate a thread.
The various signals are as follows: SIGHUP, SIGPIPE, SIGTTIN SIGINT, SIGALRM, SIGTTOU SIGQUIT, SIGTERM, SIGIO SIGTRAP, SIGUSR1, SIGXCPU
SIGABRT, SIGSYS, SIGXFSZ SIGEMT, SIGURG, SIGVTALRM SIGFPE, SIGSTOP, SIGPROF SIGKILL, SIGTSTP, SIGINFO SIGBUS, SIGCONT, SIGUSR1 SIGSEGV,
SIGCHLD, SIGUSR2
If this routine does not execute successfully, no signal is sent.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The value of sig is invalid or unsupported signal value. The value of thread does not specify an existing thread.
ERRORS
None
RELATED INFORMATION
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_kill(3)