Sponsored Content
Top Forums Shell Programming and Scripting passing file extension using external variable Post 302706261 by Skrynesaver on Wednesday 26th of September 2012 11:14:18 AM
Old 09-26-2012
If I understand your intent correctly the following should work.

Code:
#!/bin/bash
FROM=$1 
TO=$2 
FILETYPE=$3 

find $FROM -name \*.$FILETYPE -exec mv {} $TO \;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing value to an external program problem...

This code is in my 'case' statement and it all else works fine. The problem I have is that the value in 'procno' is not passed on to the external program (fireit). It is passing all zeros instead of the actual process number. By the time I get to this case statement, I know the "Number" and... (1 Reply)
Discussion started by: giannicello
1 Replies

2. Shell Programming and Scripting

Getting category when given the variable from external file to shell script

Hi, I have a script that interacts with a config file in the format: file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt I would like to return the Category, when given the file name. (11 Replies)
Discussion started by: MoreCowbell
11 Replies

3. Shell Programming and Scripting

Passing answers to external program from KSH

I have asked this before but I haven't had any luck so far getting this to work. I use RCS(revision control system). When it runs if I pass the value 'unlock' to $3 its reassigned to $unlock. When I run the command (rcs -u'version number' 'filename') ti will ask me 1-(Do you want to break the lock... (5 Replies)
Discussion started by: pjones006
5 Replies

4. Shell Programming and Scripting

passing arguments to external script

Hi! I have a python script that requires arguments and these arguments are file paths. This script works fine when executed like this: /my_python_script "file_path1" "file_path2" (i added quotes as some file names may have weird characters) the issue happens when i launch my python script... (14 Replies)
Discussion started by: gigagigosu
14 Replies

5. Shell Programming and Scripting

[Solved] Value of a variable is not recognised for commands comes from external file

Hi, my script is setting a variable with value and this variable is present in my another command that is coming from external file and this command is internally called after this variable is set. but while execution of this command, the value is not retrieved properly. say, my script... (5 Replies)
Discussion started by: rbalaj16
5 Replies

6. Shell Programming and Scripting

How can we assign value to an array variable from an external file?

is it possible to assign value to an array variable from an external file?? if yes then how?? I am using below code but its not working. #!bin/bash myarray < file_name echo ${mayarray} (6 Replies)
Discussion started by: mukulverma2408
6 Replies

7. Shell Programming and Scripting

Passing external variable to awk

Hi, I am trying to write a bash script in which I need to pass a external variable to the awk program. I tired using -v but it not accepting the value. Here is my sample code. #!/usr/bin/bash ###################################################################################### ####... (5 Replies)
Discussion started by: jpkumar10
5 Replies

8. Shell Programming and Scripting

Passing variable from file to Oracle

cat a1 scott robert tom test script : #!/usr/bin/ksh for NAME in `cat a1` do VALUE=`sqlplus -silent "nobody/bobody01@testq" <<END set pagesize 0 feedback off verify off heading off echo off select username from dba_users where username=upper('$NAME'); END` if ; then echo... (3 Replies)
Discussion started by: jhonnyrip
3 Replies

9. UNIX for Beginners Questions & Answers

Passing a file name to a variable

Below is the command mv AP_FLEXCUBE_INTERFACE10.txt FTPYMNTE_`date "+%Y%m%d%H%M%S" | tr '' ''`.TXT it is changing the file name to a different name according to time stamp dynamically. I want to capture that dynamic file name present in the directory to a variable . After that i want to... (6 Replies)
Discussion started by: sujit das
6 Replies

10. Shell Programming and Scripting

Duplicate check by passing external parameter

I have a code which is using to find duplicates in a files based on column.Below is the same code which is used to find duplicates in my file based on column 1 awk -F'|' '{if (x) { x_count++; print $0; if (x_count == 1) { print x } } x = $0}' FileName >Dup_File.txt But my requirement here is... (3 Replies)
Discussion started by: ginrkf
3 Replies
FAXRCVD(8)						      System Manager's Manual							FAXRCVD(8)

NAME
faxrcvd - HylaFAX notification script for received facsimile SYNOPSIS
/var/spool/hylafax/bin/faxrcvd qfile devid commid error-msg [ callid-1 [ callid-2 [ ... [ callid-n ] ] ] ] DESCRIPTION
bin/faxrcvd is the command script invoked by the facsimile server whenever a facsimile is received. The default script sends electronic mail to the FaxMaster user describing the content of the facsimile and other useful information such as the time spent receiving the docu- ment. The arguments are: qfile the pathname of the received TIFF file relative to the root of the spooling hierarchy. devid the modem device on which the facsimile was received. commid the communication identifier for the inbound call. error-msg an error message that is non-null if an error was encountered during the receive operation. callid the value of various identification indicators from the call NOTES
This script can route facsimile directly to the intended recipient. To do this create a shell script etc/FaxDispatch in the spooling area that sets SENDTO to the receiver's electronic mail address. For example, case "$SENDER" in *1*510*526*1212*) SENDTO=sam;; # Sam's test rig in Berkeley *1*415*390*1212*) SENDTO=raster@asd;; # 7L Xerox room, used for scanning *5107811212) SENDTO=peebles@mti;; # stuff from home esac case "$DEVICE" in ttyS1) SENDTO=john;; # all faxes received on ttyS1 ttyLT0) SENDTO=mary@home;; # all faxes received on ttyLT0 esac case "$CIDNUMBER" in 435*) SENDTO=lee; FILETYPE=pdf;; # all faxes from area code 435 5059627777) SENDTO=amy; FILETYPE=tif;; # Amy wants faxes in TIFF esac case "$SUBADDR" in 53) SENDTO=FaxMaster;; # without double-notification roger) SENDTO=roger;; # possible text subaddressing esac Note that you must match any embedded white space. The facsimile will be sent as a MIME-encoded PostScript document as default. CALLIDn is equivalent to the nth call identification parameter CIDNAME is equivalent to CALLID2 above. CIDNUMBER is equivalent to CALLID1 above. DEVICE is equivalent to device above. FILETYPE controls the filetype of the image attachment. Current filetype options are ``ps'', ``tif'', and ``pdf''. Multiple values may be specified by separating them with whitespace. In that case a separate attachment is created for each filetype. FROMADDR controls the sender of the received fax notification. It is given as an e-mail address. MSG is equivalent to error-msg above. NOTIFY_FAXMASTER (an underscore ``_'' character is between NOTIFY and FAXMASTER) indicates whether or not the HylaFAX administrator should be noti- fied regarding incoming facsimile. Default is ``always''. Also available are ``never'', which means to never send any received facsimile notification, and ``errors'', which means to send notification only if there were reception errors. SENDER is the received TSI of the fax sender. SENDTO controls the recipient of the received fax notification. It is given as an e-mail address, and it's value will be passed directly to the MTA for delivery as well as being inserted into the email. If you want to send to multiple receipients in seperate messages set the variable SENDTO1...SENDTOn in addition to SENDTO. faxrcvd will process additional SENDTOn variables starting at 1, and stopping at the first empty SENDTOn variable it finds. The templates should continue to reference $SENDTO, and faxrcvd will make sure it get's set correctly as the template is processed for each one. SUBADDR the received subaddress value, communicated by the sender for post-reception routing purposes TEMPLATE the template subdirectory to use when sending e-mails. HylaFAX ships with a base set of templates, and some direct translations. To use the German translated templates, set TEMPLATE=de in FaxDispatch. This is relative to the base template directory. Other shell variables are available. Consult the faxrcvd script directly. FILES
/var/spool/hylafax spooling area /usr/sbin/faxinfo for printing information about the facsimile /usr/bin/fax2ps for converting TIFF to PostScript /usr/lib/sendmail for delivering mail /var/spool/hylafax/etc/templates/ base directory for outgoing e-mail templates SEE ALSO
faxd(8), hylafax-server(5), recvq(5) May 28, 2001 FAXRCVD(8)
All times are GMT -4. The time now is 09:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy