Sponsored Content
Top Forums Shell Programming and Scripting Importing a path/file into a bash script Post 302484951 by TFB on Monday 3rd of January 2011 07:54:02 PM
Old 01-03-2011
No, what I'm looking for is a way to import text from the command line when I run the script.

Here is what I'm trying to do.

Code:
#! /bin/bash

echo 'Where is the file located?'
read location

COUNT=1

while [ $COUNT -lt 7 ]; do
    exif -t 0x000$COUNT --remove $location -o $location    
    let COUNT=COUNT+1
done

This little script strips out the exif GPS data (so if I upload a picture online, I don't have to worry about someone showing up at my house).

It loops from 0x0001 to 0x0006 and removes them. It then overwrites the file.

The issue is I don't want to have to type out the file names since I can't get autocomplete to work in BASH. So instead of setting the location of the file with:

Code:
echo 'Where is the file located?'
read location

I could just use ./script.sh ~/Desktop/file.jpg and script.sh will know that ~/Desktop/file.jpg shall be the location variable.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Script to display directories in Path?

Hello there, As a newbie: The directories in PATH can be hard to distinguish when printed out as one line with colon .Please, can i have a sample script to display them,one to a line. Thank you. (1 Reply)
Discussion started by: debut
1 Replies

2. Shell Programming and Scripting

importing functions from an external bash script

Hi all, I'm trying to import some functions I have saved in a file named functions.sh into a different script (protocol.sh). Can anybody show me how to do this? I tried source functions.sh as I would do at the terminal but source command cannot be found from within the script protocol.sh. ... (2 Replies)
Discussion started by: tevang
2 Replies

3. Shell Programming and Scripting

Importing env from csh to bash

Hi All, In my account with csh shell, there are lots of env variables set and I want to import those all to bash in one stroke, is there any way to do it ? Thanks, D (1 Reply)
Discussion started by: Deei
1 Replies

4. UNIX for Dummies Questions & Answers

Getting path name using bash script

I have this code to extract the directory name ($0:h) in tcsh. I am converting the code to bash and need a way to get the equivalent setting for DefRaytracPath set DefRaytracPath = `echo $0:h | awk 'BEGIN {FS="/tcsh"} {print $1"/prog"}'` (3 Replies)
Discussion started by: kristinu
3 Replies

5. Shell Programming and Scripting

Reading XML in bash and importing in Mysql

Hi, I'm not a pro bashscript writer but I'm learning and want to learn about my mistakes. In the next script I have an error on rule 6 but I can't find what I'm doing wrong ... I daily receive a file xml.xml and have to import it in an mysql database in a few existing tables. #!/bin/bash... (2 Replies)
Discussion started by: garf0r
2 Replies

6. Shell Programming and Scripting

Importing File fields into a script

Hi All, Kindly tell me how to import a file fields in a scripts scripts=adder.sh >> add values vi adder.sh (for example) N1=$1 N2=$2 N=$N1+$N2 *********** file.txt 2|1 3|4 5|6 (3 Replies)
Discussion started by: teefa
3 Replies

7. Shell Programming and Scripting

Bash script not parsing file with spaces in path

Hi everyone, I'm trying to write my first ever shell script, the OS is Raspbian. The code I have written must be executed whenever a certain database has been modified. The database resides on a Windows server to which I have a mount point, and I have no control over the Windows server at all so... (2 Replies)
Discussion started by: gjws
2 Replies

8. Shell Programming and Scripting

Moving files from parent path to multiple child path using bash in efficient way

Hi All, Can you please provide some pointers to move files from Base path to multiple paths in efficient way.Folder Structure is already created. /Path/AdminUser/User1/1111/Reports/aaa.txt to /Path/User1/1111/Reports/aaa.txt /Path/AdminUser/User1/2222/Reports/bbb.txt to... (6 Replies)
Discussion started by: karthikgv417
6 Replies

9. UNIX for Beginners Questions & Answers

Bash script - Remove the 3 top level of a full path filename

Hello. Source file are in : /a/b/c/d/e/f/g/some_file Destination is : /d/e where sub-directories "f" and "g" may missing or not. After copying I want /a/b/c/d/e/f/g/file1 in /d/e/f/g/file1 On source /a is top-level directory On destination /d is top-level directory I would like... (2 Replies)
Discussion started by: jcdole
2 Replies

10. Shell Programming and Scripting

Bash to trim folder and files within a path that share a common file extension

The bash will trim the folder to trim folder. Within each of the folders (there may be more than 1) and the format is always the same, are several .bam and matching .bam.bai files (file structure) and the bashunder that executes and trims the .bam as expected but repeats the.bam.bai extentions... (9 Replies)
Discussion started by: cmccabe
9 Replies
NGETTEXT(1)								GNU							       NGETTEXT(1)

NAME
ngettext - translate message and choose plural form SYNOPSIS
ngettext [OPTION] [TEXTDOMAIN] MSGID MSGID-PLURAL COUNT DESCRIPTION
The ngettext program translates a natural language message into the user's language, by looking up the translation in a message catalog, and chooses the appropriate plural form, which depends on the number COUNT and the language of the message catalog where the translation was found. Display native language translation of a textual message whose grammatical form depends on a number. -d, --domain=TEXTDOMAIN retrieve translated message from TEXTDOMAIN -e enable expansion of some escape sequences -E (ignored for compatibility) -h, --help display this help and exit -V, --version display version information and exit [TEXTDOMAIN] retrieve translated message from TEXTDOMAIN MSGID MSGID-PLURAL translate MSGID (singular) / MSGID-PLURAL (plural) COUNT choose singular/plural form based on this value If the TEXTDOMAIN parameter is not given, the domain is determined from the environment variable TEXTDOMAIN. If the message catalog is not found in the regular directory, another location can be specified with the environment variable TEXTDOMAINDIR. Standard search directory: /usr/share/locale AUTHOR
Written by Ulrich Drepper. REPORTING BUGS
Report bugs to <bug-gnu-gettext@gnu.org>. COPYRIGHT
Copyright (C) 1995-1997, 2000-2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for ngettext is maintained as a Texinfo manual. If the info and ngettext programs are properly installed at your site, the command info ngettext should give you access to the complete manual. GNU gettext-runtime 0.18.2 March 2013 NGETTEXT(1)
All times are GMT -4. The time now is 08:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy