#!/bin/sh
#] 
#] *********************
#] $ bash "$d_bin"'starter/proj_0_start.sh'  - menu selection of [workspace, project]s to start up
# www.BillHowell.ca  26Jan2024, adapted "$d_bin"'starter/0_start.sh'

# BEFORE running any "start[_<name>.sh" scripts, I MUST set many variables in~/.bashrc
# BEFORE running this script!! $ bash  "/media/bill/PROJECTS/bin/start.sh"


#*********************
# Setup & run - header file

# 26Dec2023 for some reason, this doesn't work several levels down when wrkSpc opened!!?? : 
#    fixed by forcing input from keyboard </dev/tty
#source  "$d_bin"'starter/0_workSpace select.sh'

# done in "$d_bin"'starter/0_start.sh'
# # 31Jan2018 Standard application delay times
# # may be overridden
# export  delay_fmg=" 3s"
# export  delay_trm=" 2s"
# export  delay_brs=" 4s"
# export  delay_edt=" 3s"
# export  delay_LOf=" 4s"
# export  delay_pdf=" 4s"
# 
# 
# export d_start="$d_bin""starter/"
# export d_reviews="$d_PROJECTS"'My Reviews/'
# start_base="1 3 5"

#*********************
# Run  

	echo ''
	echo '******************************'
	echo "HOWELL_computer= $HOWELL_computer"
	echo 'The result above should show one of [LMDE2,Ubuntu,Dell64,RaspPi]'
	echo '******************************'
	echo 'bash start script selection'
	echo 'www.BillHowell.ca  09Jan2018 initial version'
	echo '1st col = themeCode; 2nd col = pre-defined WorkSpace (wrkSpc, if exists)'
	echo ''
#	echo 'from "$d_bin""starter/0_start.sh"'  
#	echo '60  -  proj_0_start.sh             [list, start] long list of projects'  
	echo 'Family'  
	echo '1   -  family_DadHistory.sh        Neil Howells history (I lost the directory!!??)'  
	echo 'History'  
	echo '10  -  history_Icebreaker.sh       Icebreaker history'  
	echo '15  -  history_Ukraine.sh          Ukraine-Russia [news, analysis]'  
	echo '18  -  history_Wickson.sh          Wicksons book 900y climate cycle'  
	echo 'Physics'  
	echo '24  -  proj_Kaal.sh                Edo Kaals Structured Atom Model (SAM)'  
	echo '30  -  proj_Lies.sh                Sumry,Climate,GR,QM,LightSpeed'  
	echo 'Pandemics'  
	echo '40  -  proj_covid.sh               covid, covax[news, analysis]'  
	echo ''  
if   [ '$HOWELL_computer' = 'RaspPi' ]; then 
	echo 'On boot : dont forget to set the date & time for [Lenovo,RaspPi]!!!'
	echo 'WARNING!  wireless is turned off for Raspberry Pi as site startups are too slow!'
	echo '   waiting for wireless turn-off...'
   sudo ifdown wlan0
   sleep 4s
   echo ''
fi
echo ''


read -p 'Enter a list of numbers, separated by single spaces (q to exit): '  line_input
#echo "line_input is : $line_input"

line_input=$(echo "$line_input" |  sed "s/999/$start_base/" ) 
quit=$(echo  "$line_input"  |  grep --only-match "q")

if   [ "$quit" == "q" ];then
	echo "quit q encountered - no startups"
else
   echo "$line_input"  |  tr '[:blank:]'  '\n'  |  xargs --max-args=1  bash "$d_start"'1_input.sh'
fi

# line_input="1 3 q 5 6"






# enddoc


