Lunch rand: Difference between revisions

From Wiki
Jump to navigation Jump to search
New page: """In preparation""". Usage (written for python 3.5 and newer): This script will randomly decide where you should go for lunch: # copy following text to blank file named ""lunch_rand.sh"...
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
"""In preparation""".
"""In preparation"""
Usage (written for python 3.5 and newer):


This script will randomly decide where you should go for lunch:
This script will randomly decide where you should go for lunch:


# copy following text to blank file named ""lunch_rand.sh""
* copy following text to blank file named ""lunch_rand.sh""


#! /bin/bash
#! /bin/bash


echo Here are the choices where you can go for lunch:
echo Here are the choices where you can go for lunch:
echo
echo
echo "1) URV
echo "1) URV
2) ICIQ
2) ICIQ
3) Chinos (across the street)
3) Chinos (across the street)
4) Burger place
4) Burger place
5) Pizza up the street
5) Pizza up the street
6) delta" > e.tmp
6) delta
cat e.tmp
7) hugo" > e.tmp
echo
cat e.tmp
echo Your faith has been decided:
echo
odlucivalac=$((RANDOM % 6))
echo Your faith has been decided:
#echo $odlucivalac
odlucivalac=$(echo $((RANDOM % 7)) + 1 | bc)
head -$odlucivalac ./e.tmp | tail -1  
#echo $odlucivalac
head -$odlucivalac ./e.tmp | tail -1 ; rm e.tmp


# make ""lunch_rand.sh"" executable:
* make ""lunch_rand.sh"" executable:
     chmod +x curls.py
     chmod +x curls.py


# to run script type:
* to run script type:
     ./lunch_rand.sh
     ./lunch_rand.sh


# now you can go for lunch
* now you can go for lunch

Latest revision as of 12:47, 17 February 2020

"""In preparation"""

This script will randomly decide where you should go for lunch:

  • copy following text to blank file named ""lunch_rand.sh""
#! /bin/bash
echo Here are the choices where you can go for lunch:
echo
echo "1) URV
2) ICIQ
3) Chinos (across the street)
4) Burger place
5) Pizza up the street
6) delta
7) hugo" > e.tmp
cat e.tmp
echo
echo Your faith has been decided:
odlucivalac=$(echo $((RANDOM % 7)) + 1 | bc)
#echo $odlucivalac
head -$odlucivalac ./e.tmp | tail -1 ; rm e.tmp
  • make ""lunch_rand.sh"" executable:
   chmod +x curls.py
  • to run script type:
   ./lunch_rand.sh
  • now you can go for lunch