Results 1 to 3 of 3

Thread: Need help to create a bash script

  1. #1
    Join Date
    Sep 2011
    Location
    Nasik, MH, India
    Beans
    83
    Distro
    Ubuntu 13.10 Saucy Salamander

    Question Need help to create a bash script

    Hi Friends,


    I need help to create a bash script. I use exiftool command to update metadata of a pdf file in following format


    Code:
    exiftool -Subject="Some Text:DD-MMM-YYYY" -Title="Some Text: DD-MMM-YYYY"-ModDate=”YYYY:mm:dd HH:MM:SS” -CreationDate=”YYYY:mm:dd HH:MM:SS” filenameDDMMYYYY.pdf

    I need to create a bash script which get current date and time and replace DD with date in format like 04, MM in format like 01, MMM informat like Jan, HH:MM:SS, in format like 08:45:34 and YYYY in format like 2014 and script replace all DD, MM, MMM, YYYY, HH:MM:SS and then execute the command



    Canany one help me create the script?


    Thanksin advance
    Last edited by sujitrjadhav; January 19th, 2014 at 07:59 PM.

  2. #2
    Join Date
    Jan 2010
    Location
    Kolkata India
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Need help to create a bash script

    date command is your friend. Few examples below.

    Code:
    fego@production:~$ date +%b
    Jan
    fego@production:~$ date +%d
    20
    fego@production:~$ date +%m
    01
    fego@production:~$ date +%T
    00:33:44
    “Progress is made by lazy men looking for easier ways to do things”
    — Robert A. Heinlein

  3. #3
    Join Date
    Sep 2011
    Location
    Nasik, MH, India
    Beans
    83
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Need help to create a bash script

    Thanks very much. codemaniac. I did not know anything about bash programming. But after some trial and error I am able to create a script that does what I want.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •