Write a Bash script that would execute the following commands and print their exit statuses:

1. date
2. date blah
3. somenonexistingcommand

Here is the Bash script that would execute the following commands and print their exit status:

```
#!/bin/bash

# Execute command 1 and print the exit status
date
echo "Command 1 Exit Status: $?"

# Execute command 2 and print the exit status
date blah
echo "Command 2 Exit Status: $?"

# Execute command 3 and print the exit status
somenonexistingcommand
echo "Command 3 Exit Status: $?"
```

Explanation:

- `#!/bin/bash` is the shebang that specifies the script should be executed in Bash shell.
- The first command `date` will get the current date and time and show it on the console.
- `$?` is a special variable in Bash that returns the exit status of the last executed command. By printing it, we can see whether the command was successful (0) or had an error (non-zero).
- The second command `date blah` will produce an error because `blah` is not a valid option for `date`.
- The third command `somenonexistingcommand` will also produce an error because it is not a valid command.

When you run this script, it will output the current date and time followed by the exit statuses of each command.

To write a Bash script that executes the given commands and prints their exit statuses, follow these steps:

Step 1: Open a text editor and create a new file. Give it a name, for example, `script.sh`.

Step 2: Add a shebang line as the first line of the file to specify the interpreter. In this case, use `#!/bin/bash`.

Step 3: Write the commands in the script. To execute a command in Bash, use the `command` syntax.

Here's a sample script that includes the given commands:

```bash
#!/bin/bash

# Execute 'date' command
date
echo "Exit Status: $?"

# Execute 'date blah' command
date blah
echo "Exit Status: $?"

# Execute 'somenonexistingcommand' command
somenonexistingcommand
echo "Exit Status: $?"
```

Step 4: Save the file `script.sh` and exit the text editor.

Step 5: Make the script executable by running the following command in the terminal:
```bash
chmod +x script.sh
```

Step 6: Run the script by executing the following command:
```bash
./script.sh
```

The script will execute the commands and print their exit statuses.

Sure! Here's a step-by-step guide to write a Bash script that executes the commands and prints their exit statuses:

1. Open a text editor and create a new file. Let's name it `script.sh`.

2. Add the following lines to the `script.sh` file:

```bash
#!/bin/bash

# Execute 'date' command and store the exit status in a variable
date
exit_status_date=$?

# Execute 'date blah' command and store the exit status in a variable
date blah
exit_status_date_blah=$?

# Execute 'somenonexistingcommand' command and store the exit status in a variable
somenonexistingcommand
exit_status_somenonexistingcommand=$?

# Print the exit statuses
echo "Exit status of 'date' command: $exit_status_date"
echo "Exit status of 'date blah' command: $exit_status_date_blah"
echo "Exit status of 'somenonexistingcommand' command: $exit_status_somenonexistingcommand"
```

3. Save the file `script.sh` and close the text editor.

4. Open a terminal and navigate to the directory where you saved `script.sh`.

5. Make the script executable by running the following command:

```bash
chmod +x script.sh
```

6. Finally, run the script by executing the following command:

```bash
./script.sh
```

You will see the output of the `date` command and the exit statuses printed on the terminal. The exit status will be a number that indicates the success or failure of each command.