Homework of week 04 (Submission deadline: 23:59, Sep. 30, 2025)

  1. Fix your Problem 6 last week to avoid integer overflow. Also reformat the final output into one single continuous numeric string without any backslash and line-breaks.
    • Write a shell script to calculate $n!=\prod\limits_{k=1}^n k = 1\times 2\times 3\times 4\times... \times (k-1) \times k$ for any positive integer $n$.
      In addition, for the case that given $n\lt0$, print an error message "Input number must be a positive integer!!" to the user;
      for $n=0$, print $1$ because by definition, $0!=1$.

      Send the filename of these shell scripts including their absolute path to me by email.

      Hint: For the judgement of condition in bash, refer here. Using if...then would be the simplest but you could also try other syntax.

    See also:

    Note: If you did something weird and got stuck under bash without getting the shell-prompt returned, you can hit Ctrl-C to quit the process.
    jsyu@Ukko:~$ grep "[ugd][0-9a][0-9]\{6\}" /etc/passwd | awk -F: '{ print something wrong here }'
    >
    >
    >
    > ^C
    jsyu@Ukko:~$
    
  2. Use Scalable Vector Graphics (SVG) code to plot the figure that you drew by hand for the Problem 5 last week. Put the figure together with the $\LaTeX$ codes that illustrate $ 4\times arctan(1)=\pi $ under your ~/public_html/ and submit the weblink to me and CC: to TA.
    Note: Do NOT copy my SVG code; you need to generate the plot by yourself according to your submission last week.

    See also here for a brief tutorial for SVG.
    Reference for SVG.

  3. Demonstrate that you are able to boot your desktop or laptop PC with the USB flash installed with Linux in class. You can record the screen with your cellphone starting from power-on until you login your own machine, and upload the video to youtube. Also write a short paragraph describing how you configure the BIOS/UEFI firmware to boot your computer with Linux.
    Put all of the information together and present as either an HTML file under your ~/public_html/ or a PDF file, and submit the weblink or file to me and CC: to TA.
    Remember to specify the brand (廠牌) and model number (型號) of your computer in the homework.
    Note: You will need to disable the secure boot option in the UEFI to boot Linux from USB flash.
    If the UEFI does not allow you to turn off secure boot, try to enable the CSM function so as to boot your system in legacy-BIOS compatible mode.