PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Amazon

Implement a formatted shell script output

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in shell scripting, command-line argument validation, file existence and permission checks, parsing a license value from a file, and timestamp formatting.

  • Medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Implement a formatted shell script output

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Write a shell script named script.sh that is invoked as: ./script.sh <username> <path_of_file>. It must print a single line formatted exactly as: <timestamp> <license> <user@hostname>. Use the supplied username and the current machine’s hostname, and parse the license value from the file at <path_of_file>. Include argument validation (missing args), file existence/permission checks, and clearly define the timestamp format you choose.

Quick Answer: This question evaluates proficiency in shell scripting, command-line argument validation, file existence and permission checks, parsing a license value from a file, and timestamp formatting.

Related Interview Questions

  • Implement Datacenter Router Commands - Amazon (hard)
  • Replace Delimited Tokens in a String - Amazon (medium)
  • Minimize Circular Redistribution Cost - Amazon (medium)
  • Find the Most Common Visit Pattern - Amazon (hard)
  • Maximize Value Under a Budget - Amazon (medium)
Amazon logo
Amazon
Aug 10, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0

Write a shell script named script.sh that is invoked as: ./script.sh <username> <path_of_file>. It must print a single line formatted exactly as: <timestamp> <license> user@hostname. Use the supplied username and the current machine’s hostname, and parse the license value from the file at <path_of_file>. Include argument validation (missing args), file existence/permission checks, and clearly define the timestamp format you choose.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.