the image is displayed
How to run at the same time?
Code: Select all
#! /bin/bash
madplay ivy.mp3 "$@"
xcowsay --cow=Lobster6 --time=1 --dream=puppylogo96.png "$@"
Code: Select all
#! /bin/bash
madplay ivy.mp3 "$@"
xcowsay --cow=Lobster6 --time=1 --dream=puppylogo96.png "$@"
Many things will run in multiple tasks if you put the "&" on the end of the line.Lobster wrote:In this prog, the music plays then when it stops
the image is displayed
How to run at the same time?
Sure I have asked this before - can not find replyCode: Select all
#! /bin/bash madplay ivy.mp3 "$@" xcowsay --cow=Lobster6 --time=1 --dream=puppylogo96.png "$@"
Code: Select all
madplay ivy.mp3 "$@" &
xcowsay --cow=Lobster6 --time=1 --dream=puppylogo96.png "$@" &
echo "And this too"
Code: Select all
#!/bin/sh
#This opens several terminals, one per second. At the same time, a
#Different set of code gradually draws an image on the screen.
#Create the files
(
#try to find a terminal
for i in xterm rxvt urxvt sakura; do
which $i >/dev/null && terminal=$i
done
for i in {0..3}; do
urxvt &
sleep 1
done
) &
########################################################################
#This part does the drawing of cool things.
#Note: If you want to use this independently of this example, just cut
#everything below the following line. All the above is irrelevant.
###--------- CUT AFTER THIS --------------------------------------------
#!/bin/sh
#Draws a pretty picture
#This looks best in a terminal with a black background. For example:
# rxvt -bg black -fg white
h=12
tw=4 #even for alignment
th=3
#increasing this dehances the chrome factor
scarcity=9
###################################################
#define a bunch of colors
#the capitalized versions are "bold" or "bright"
black='\033[0;30m'
BLACK='\033[1;30m'
white='\033[0;37m'
WHITE='\033[1;37m'
red='\033[0;31m'
RED='\033[1;31m'
green='\033[0;32m'
GREEN='\033[1;32m'
yellow='\033[0;33m'
YELLOW='\033[1;33m'
blue='\033[0;34m'
BLUE='\033[1;34m'
purple='\033[0;35m'
PURPLE='\033[1;35m'
cyan='\033[0;36m'
CYAN='\033[1;36m'
NC='\033[0m'
grey=$BLACK
###################################################
char1="${green}/${NC}"
char2="${green}^${NC}"
char3="${green}\\\\${NC}"
chart1="${yellow}|${NC}"
chart2="${yellow}=${NC}"
chart3="${yellow}|${NC}"
function draw_bulb(){
char="*"
color_pool=($RED $YELLOW $BLUE $CYAN $PURPLE)
let "index=RANDOM%${#color_pool[@]}"
echo "${color_pool[$index]}${char}${NC}"
}
function draw_item(){
boring="$1"
let 'decision=RANDOM%scarcity'
if [ $decision -eq 0 ]; then
draw_bulb
else
echo "$boring"
fi
}
let 'w=h*2'
let 'cx=w/2'
let 'cy=h/2'
for x in $(seq 0 $cx); do
line_start="${line_start} "
done
echo -e "${line_start}${WHITE} _A_ ${NC}"
echo -e "${line_start}${WHITE} /^\ ${NC}"
for y in $(seq 1 $h); do
let 'x1=cx-y+1'
let 'x2=cx+y-1'
line=''
for x in $(seq 0 $x1); do
line="${line} "
done
line="${line} $(draw_item "$char1")"
let 'start=x1+1'
let 'end=x2-1'
for x in $(seq $start 2 $end); do
line="${line} $(draw_item "$char2")"
#line="${line} ${char2}"
done
line="${line} $(draw_item "$char3")"
echo -e "$line"
let 'y++'
done
for y in $(seq 1 $th); do
let 'x1=cx-tw/2'
line=''
for x in $(seq 0 $x1); do
line="${line} "
done
line="${line} ${chart1}"
let 'start=x1+1'
let 'end=x1+tw'
for x in $(seq $start 2 $end); do
line="${line} ${chart2}"
done
line="${line} ${chart3}"
echo -e "$line"
done
Code: Select all
//dr 0.1 by Iguleder
// To compile:
// gcc -lpthread -o dr dr.c
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void *runThread(void *command)
{
system(command);
}
int main(int argc, char** argv) {
pthread_t commandThreads[argc-1];
long i;
for(i=1; i<=argc-1; i++)
{
pthread_create(&commandThreads[i-1], NULL, runThread, (void *)argv[i]);
}
pthread_exit(NULL);
}