How to email the current directory? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

How to email the current directory?

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-21-2013
rnmuk rnmuk is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 9 July 2013, 5:20 PM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
How to email the current directory?

Hi, I'm very new to Unix, but have been given a command to type in which is :


Code:
mail -s <email subject goes here>  <my email address> <success.txt

this command is quite a basic one and sends an email containing the contents of the file "success.txt" to whatever email I put in with the subject of the email after the -s and works fine. What I would like to do is replace the subject of the email with the current folder name, but don't want to type it in directly I want Unix to enter the follder name automatically, is this possible, maybe by using the "pwd" command?

Last edited by Scott; 06-21-2013 at 03:38 AM.. Reason: Please use code tags
Sponsored Links
    #2  
Old Unix and Linux 06-21-2013
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 2 April 2015, 3:39 AM EDT
Location: San Jose, CA, USA
Posts: 5,968
Thanks: 242
Thanked 1,994 Times in 1,701 Posts
Quote:
Originally Posted by rnmuk View Post
Hi, I'm very new to Unix, but have been given a command to type in which is :


Code:
mail -s <email subject goes here>  <my email address> <success.txt

this command is quite a basic one and sends an email containing the contents of the file "success.txt" to whatever email I put in with the subject of the email after the -s and works fine. What I would like to do is replace the subject of the email with the current folder name, but don't want to type it in directly I want Unix to enter the follder name automatically, is this possible, maybe by using the "pwd" command?
If you're using a shell that accepts basic Bourne shell syntax (such as a Bourne shell, bash, or ksh), you can just use:

Code:
mail -s "$PWD" <my email address> <success.txt

Sponsored Links
    #3  
Old Unix and Linux 06-21-2013
rnmuk rnmuk is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 9 July 2013, 5:20 PM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
excellent

Thank you Don Cragun, that works perfectly, excellent.
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Current working directory jimjam UNIX for Dummies Questions & Answers 4 07-31-2012 05:30 PM
tarball of current directory nishrestha Shell Programming and Scripting 1 10-22-2011 10:25 AM
Finding files in current directory when 100,000's files in current directory kewong007 Shell Programming and Scripting 2 02-26-2009 02:13 PM
filename in current directory calgone337 Shell Programming and Scripting 2 04-15-2007 02:21 PM
cannot determine current directory axes UNIX for Advanced & Expert Users 15 11-13-2006 06:39 AM



All times are GMT -4. The time now is 03:49 AM.