How i can place in a log file an automatic chrome opener?


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers How i can place in a log file an automatic chrome opener?
# 1  
Old 07-31-2019
How i can place in a log file an automatic chrome opener?

Okay, so i have this problem, i have a raspberry with rasbian lite (now i have openbox running on) and i do a few script for my client. But i have a question and a problem.... i got the logs file, that file need to open automatically the browser without having to do all the steps again at the next startup(i run this bash file every start up automatically)




thats my script (im from italy ):

Code:
#!/bin/bash
clear

if [ -f logs.sh ];
        then echo "sarai reindirizzato alla tua pagina di default di "; cat logs.sh
        exit 0

fi



echo "Da che scuola provieni?"
sleep 1
echo "Sono disponibili queste opzioni:"
sleep 1
echo "[1] CPC Belli"
echo "[2] CPT Locarno"
echo "[3] CPC Chiasso"
echo "[4] SPSE Tenero"
sleep 1
testo="Okay ora verrai reindirizzato nel sito web di"
echo "Inserisci il numero della scuola che frequenti:"
read NUM
case $NUM in

1)      echo "$testo CPC Bellinzona"
        chromium-browser £INTERNET WEBSITE£
        ;;
2)      echo "$testo CPT di Locarno"
        chromium-browser £INTERNET WEBSITE£
        ;;
3)      echo "$testo CPC di Chiasso"
        chromium-browser £INTERNET WEBSITE£
        ;;
4)      echo "$testo SPSE Tenero"
        chromium-browser £INTERNET WEBSITE£
        ;;
*)      echo "La tua scuola non è presente in lista"
esac
echo "chromium-browser $NUM" >> logs.sh
exit 0

this is the error, its not a error but i dont know how to set in default the person choise in the case
Code:
sarai reindirizzato alla tua pagina di default di $1

i know im bad in English but please help me!!!!
# 2  
Old 07-31-2019
I'm not sure what you want - it looks like you want the default case to open the browser - default is the choice of the user.
Question: the user enters the number 3. The case statement will execute the code block for 3.
So, the user's choice gets taken correctly, correct?

If the user enters 67- which is not in the list - then the default case statement will execute. Right?
So what is your your request for default? I do not understand. You could add echo 'none of these' as a choice.
When the user selects 'none', then the case *) statement executes and you get the extra choice:
Code:
*)  echo "La tua scuola non è presente in lista"
    echo "enter your own choice"
    read mychoice
    chromium-browser   "$my_choice"
   ;;
esac

Plus some of your characters render as a British pound sign on my screen: (pound)INTERNET WEBSITE(pound) so I'm not sure what that means in your code....
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search for a file in all directories and place the file in that directory

Hi All, Daily I am getting the updated file. I have to search for this file in all directories and sub directories. If the file existed in a particular directory then move this updated file to that particular directory. If the file is not existed in any of the directories then place this... (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies

2. Shell Programming and Scripting

Check file availability and place flag file

I have to check a directory on Linux (via shell Script which I am trying to build) for about 20 different source files with file patterns and if the files are made available in the directory, I should place flag files for which my other ETL jobs are waiting on to kick off. If the source files are... (6 Replies)
Discussion started by: dhruuv369
6 Replies

3. Shell Programming and Scripting

Automatic Email of Log Files in OSX

Hi, I am trying to write a shell script that will take the log files from a single folder (all ending with .log), put them into an archive, use something to encrypt the file, and then emailx to email the resulting encrypted archive to me. Of course, I am open to suggestions on how to improve... (1 Reply)
Discussion started by: DotNaBox
1 Replies

4. Shell Programming and Scripting

Read from file specific place in file using inode

Hello, I am using tcsh on AIX. I would like to write a script that does the following: 1. given an inode, how do I find exactly the name of the file? I know I could do this using ls -i | grep <inode> but it returns: <inode> <filename>. I need some string manipulation or something to... (1 Reply)
Discussion started by: lastZenMaster
1 Replies

5. UNIX for Dummies Questions & Answers

Changing default PDF opener

Hi, I want to open a pdf file in my PCLinuxOS, but when I click on the PDF file to open it, a message box prompts asking for Open With : KGhostView ; Save File....etc. So the default pdf genereator to open is set to KGhostView. How do I change the default to KPdf, another pdf generator.. ... (3 Replies)
Discussion started by: anaigini45
3 Replies

6. Solaris

What is the best way to copy data from place to another place?

Dear Gurus, I need you to advice or suggestion about the best solution to copy data around 200-300G from serverA(location A) to serverB(location B). Normally, I will share folder and then copy but it takes too long time(about 2 days). Do you have any suggestion or which way should be... (9 Replies)
Discussion started by: unitipon
9 Replies

7. Shell Programming and Scripting

editing file in place

Is in Unix a tool that could do this: paste -d":" 'file1' 'file2' | special_save "file1" # so that file1 would be treated in a way that would prevent problems with race condition I know it normally doesn't work but is there any intelligent way how to avoid using temporary file? I know methods... (6 Replies)
Discussion started by: MartyIX
6 Replies

8. Shell Programming and Scripting

ksh - truncate a log in place, sed -i not available captain!

Hi there:) Because of security requirements, It would be much better if I could truncate my logs in place using sed -i (or ?). I cant use the -i option on sed in my environment. Can anyone help a DBA? (5 Replies)
Discussion started by: quigley007
5 Replies

9. Solaris

Automatic Log files to my E-mail.

Hi, I have 6 servers, I want to make a script to read the messages (/var/adm/messages) file daily in the morning and send it automatically to my E-mail address. Regards (2 Replies)
Discussion started by: adel8483
2 Replies
Login or Register to Ask a Question