Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script that takes filename or the filename with its full path as an input during execution and display ls -l command result for inputted file

Posted By: Maria Hughes     Category: Unix / Linux / Ubuntu     Views: 5882

Write a shell script, which will receive either the filename or the filename with its full path #during execution. This script should obtain information about this file as given by ls –l and #display it in proper format.

Code for Shell script that takes filename or the filename with its full path as an input during execution and display ls -l command result for inputted file in Unix / Linux / Ubuntu

echo "Enter any file name or file path"
read file

ls -l $file

-------------------------------------------------------------------
output
-------------------------------------------------------------------

Enter any file name or file path
cut
-rw-r--r--    1 mca258   502             0 Sep 22 15:53 cut
  
Share: 



Maria Hughes
Maria Hughes author of Shell script that takes filename or the filename with its full path as an input during execution and display ls -l command result for inputted file is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!