Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

The Insider's Guide to Accessing NLM Data

$ (dollar-sign)


As new Insider's Guide classes are no longer being offered, this site is not currently being updated. Please refer to NCBI's E-utilities documentation for more up-to-date information.


The Unix operator “$” can be used to access the value of a variable or command. This can be especially useful in conjunction with the cat command to include the contents of a file in another Unix command.

Example

If you have a search string saved in a text file (searchstring.txt), and would like to use that search string as the value for the esearch -query argument without having to re-type it or copy and paste, you can use the value of cat searchstring.txt (i.e. the contents of the file “searchstring.txt”) as the -query argument for an esearch command.

esearch -db pubmed -query "$(cat searchstring.txt)"

Last Reviewed: August 6, 2021