I have this exactly as it says on #2 but I don't get any return command from bash firstscript.sh // is there a typo in the command provided or??? am I a Potatoe
Create and execute a simple Bash script.
Use the vim command to create the firstscript.sh file under your home directory.
[student@servera ~]$ vim firstscript.sh
Insert the following text, and save the file. The number of hash signs (#) is arbitrary.
#!/usr/bin/bash echo "This is my first bash script" > ~/output.txt echo "" >> ~/output.txt echo "#####################################################" >> ~/output.txt
Use the bash command to execute the script.
[student@servera ~]$ bash firstscript.sh
@hedai710 you can try writing the same bash script in two steps :
1. first write it without the > or >> redirection part and run the script to see what is happening and
2. write it with the > / >> as depicted in the course and run it to see the difference.
Bash scripting is basically the commands that you write in the terminal with some logic applied to achieve a goal ! These commands can range from simple file operations to complex logic structures, enabling automation of tasks and system management.
So practice commands more with standard redirection techniques ( stdin , stdout and stderr ) and you will get the bash scripting !
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.