Join Scott Simpson for an in-depth discussion in this video Exploring some handy helpers: date and printf, part of Learning Bash Scripting.
…I want to take a couple minutes to talk about DATE and PRINTF.…DATE is not part of Bash but it's really useful for certain kinds of scripts.…The DATE command gives you a format like…this, and you can use a string formatting option,…the character + followed by a format specifier in…quotes, to get pretty much any format you need.…Here I've used %d-%m-%Y.…And that gives me the day, the month, and the year.…Here's another one.…Percent capital H, dash percent capital M, dash percent capital S,…and that's the hours, minutes, and seconds of the current time.…
You can explore all of the other format specifiers…on dates manpage, and it's a couple pages down.…As you can see, there's a whole bunch of things that you can use.…And I encourage you to explore those.…I'll hit Q to quit out of here.…Another handy tool is print f, a built in that comes…with Bash, which lets you print out data with a particular format.…While you can use echo to lay out…text manually, printf gives you a lot more options.…Let's take a look at some of them.…
- What is Bash?
- Managing output with grep, awk, and cut
- Understanding Bash script syntax
- Creating a basic Bash script
- Displaying text with "echo"
- Working with numbers, strings, and arrays
- Reading and writing text files
- Working with loops
- Using functions
- Getting user input during execution
- Ensuring a response
Skill Level Beginner
Linux: Bash Shell and Scriptswith Kevin Dankwardt2h 46m Intermediate
1. Working with the Command Line
2. Building Bash Scripts
3. Control Structures
4. Interacting with the User
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.