Sponsored Content
Top Forums Shell Programming and Scripting Recursively hard linking files -- bonehead question Post 302256610 by scyphers on Monday 10th of November 2008 08:44:22 AM
Old 11-10-2008
Quote:
Originally Posted by Annihilannic
Code:
srcdir=/some/dir
targetdir=/some/other/dir
  {{snip}}
find $srcdir |
  {{snip}}
    dest=$(echo $f | sed "s#$srcdir#$targetdir#")
  {{snip}}

Okay, so to make source directory and target directory command line parameters, it would be something like:

Code:
srcdir=$1
targetdir=$2

Right?
 

10 More Discussions You Might Find Interesting

1. Programming

compiling and linking 2 C files ...??

Hi mates, I am trying to copile and link to C programs with command: cc file1,file2 but i raises the error "file not found" ... am i doing the right way? any suggestion will be appreciated. thanks abdul (4 Replies)
Discussion started by: abdul
4 Replies

2. Programming

Linking problem while linking to shared library

Hi I'm getting ld: fatal: option -h and building a dynamic executable are incompatible ld: fatal: Flags processing errors When I run ld -shared -L/usr/dt/lib -lDtSvc -o builtin.so Workspace.o after running gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c I'm... (6 Replies)
Discussion started by: laho
6 Replies

3. UNIX for Dummies Questions & Answers

modifying C file and linking back to project files

hi, This is the first time I work in a big C project. All source code files are located in say directory /source/pp and all header files are in /include/pp. I've created a link to both of these directories from my home dir, say /home/ss. So in the /home/ss dir I have the /source/pp and /include/pp... (1 Reply)
Discussion started by: bruins2005
1 Replies

4. UNIX for Dummies Questions & Answers

Linking Files in UNIX (shortcuts)

Hello, Can anyone tell me how I can make a file link or shortcut in UNIX 4.0, several file links where damaged during an outage examples below. Examples: file -> file libX11.so -> /usr/shlib/libX11.so.pre.O3D All of the file links that were damaged were in /shlib and point to... (3 Replies)
Discussion started by: jays337
3 Replies

5. Programming

C files searching and Linking

Dear friends, First off all , let me apologize for my inexperience. I am just starting use of Linux and gcc . Actually I ve some .c files in the present directory , and now I am giving +vc <my_file1.c> <my.file2.c> <myfile3.c>. All the c files are in present directory.... (2 Replies)
Discussion started by: user_prady
2 Replies

6. UNIX for Advanced & Expert Users

hard question

I have a directory containing a series of files of the format: A2008001231000.L2 I only care about the 6-8 digits, so the files are effectively: ?????---*.L2 I have files that range from ?????001*.L2 to ?????366*.L2 It should be noted these three digits represent the julian day of the... (2 Replies)
Discussion started by: msb65
2 Replies

7. UNIX for Dummies Questions & Answers

Need help in moving files recursively

Hi, I have d1,d2,d3 directories / /home/abc/d1 /home/abc/d2 /home/abc/d3 d1,d2 and d3 also have subdirctories. d1-->d11-->d12 d2-->d22-->d23 d3-->d33-->d34 All these directories have files like date_filename.txt so I want to find the files recusively for a particular date from... (1 Reply)
Discussion started by: jagadish_gaddam
1 Replies

8. Shell Programming and Scripting

Recursively move directories along with files/specific files

I would like to transfer all files ending with .log from /tmp and to /tmp/archive (using find ) The directory structure looks like :- /tmp a.log b.log c.log /abcd d.log e.log When I tried the following command , it movies all the log files... (8 Replies)
Discussion started by: frintocf
8 Replies

9. Shell Programming and Scripting

Script for linking files with paths in 2 text files

I have 2 txt files, 1.txt and 2.txt which contain the paths to files that need to be linked. Example 1.txt: /root/001/folder2/image4.nii.gz /root/002/folder2/image4.nii.gz Example 2.txt: /root/001/folder2/image5.nii.gz /root/002/folder2/image5.nii.gz Each line represents images from... (7 Replies)
Discussion started by: LeftoverStew
7 Replies

10. Programming

Linker errors linking to .a files on OS X

Basically my problem is that when I try to compile anything using ./configure && make, it fails because of linker errors. I can reproduce the behavior I'm getting as follows: I have the two following files main.c: #include <stdio.h> extern void func(void); int main(int argc, char... (5 Replies)
Discussion started by: MarshallBanana
5 Replies
ETCUPDATE(8)						    BSD System Manager's Manual 					      ETCUPDATE(8)

NAME
etcupdate -- update the configuration and startup files in /etc SYNOPSIS
etcupdate [-ahlv] [-p pager] [-s {srcdir | tgzdir | tgzfile}] [-t temproot] [-w width] DESCRIPTION
etcupdate is a tool that lets the administrator update the configuration and startup files in /etc (and some other directories like /dev, /root and /var) without having to manually check and modify every file. The administrator should run this script after performing an operat- ing system update (e.g. after running make build in /usr/src or after extracting new binary distribution files) to update to the latest con- figuration and startup files. etcupdate compares the new configuration files against the currently installed files. The user is given the option of installing, merging or deleting each modified or missing file. The user can also view the differences between the files. By default, it shows the differences in the unified diff format. The default format can be toggled to show the differences in unified, context, or side by side formats or an user- defined command may be used to view differences. (And if wdiff is installed, it can also show differences on a word by word basis.) etcupdate also detects if the user installs certain special files and performs corresponding tasks like remaking device nodes or rebuilding a database from the aliases(5) file. Finally, etcupdate runs postinstall(8) to check the results. etcupdate needs a clean set of new configuration files to compare the existing files against. These files, called the ``reference files'' in this manual, may be derived from either a source or binary distribution of NetBSD. If the user is updating from sources (which is the default mode), etcupdate will first create a copy of the reference files by running make distribution in /usr/src/etc, installing the files to a so-called temproot. (See usage of the -s srcdir and -t temproot options later in this manual page.) Although this is the default mode, it is not recommended (see the ``BUGS'' section). Instead of using sources, it is recommended that the user should extract one or more binary distribution sets in a special location and use those as the reference files (see usage of the -s tgzdir option later in this manual page), or specify one or more binary distribution sets directly (see usage of the -s tgzfile option later in this manual page). The following options are available: -a etcupdate can automatically update files which have not been modified locally. The -a flag instructs etcupdate to store MD5 checksums in /var/etcupdate and use these checksums to determine if there have been any local modifications. -h Prints a help text. -l Automatically skip files with unchanged RCS IDs. This has the effect of leaving alone files that have been altered locally but which have not been changed in the reference files. Since this works using RCS IDs, files without RCS IDs will not be skipped even if only modified locally. This flag may be used together with the -a flag described above. -p pager The pager to use when displaying files. By default this is more(1) but it can be changed either with this option or by defin- ing the PAGER variable. -s {srcdir | tgzdir | tgzfile} The location of the reference files, or the NetBSD source files used to create the reference files. This may be specified in one of three ways: -s srcdir The top level directory of the NetBSD source tree. By default this is /usr/src but it can be changed either with this option or the SRCDIR variable. The reference files will be created by running ``make distribution'' in the srcdir/etc directory. Note that srcdir should refer to the top of the source directory tree; earlier versions of etcupdate expected srcdir to refer to the etc subdirectory within the source tree. -s tgzdir A directory in which reference files have been extracted from a binary distribution of NetBSD. The files that are distributed in the ``etc.tgz'' set file must be present. The files that are distributed in the ``xetc.tgz'' set file are optional. The reference files from the specified directory will be copied to the temproot directory. -s tgzfile The location of a set file (or ``tgz file'') such as ``etc.tgz'' or ``xetc.tgz'' from a binary distribution of NetBSD. Each set file is a compressed archive containing reference files, which will be extracted to the temproot directory. Multiple -s options may be used to specify multiple set files. The ``etc.tgz'' set file must be specified. The ``xetc.tgz'' set file is optional. -t temproot Specifies the location of the temproot directory. This directory will be used for a temporary copy of the reference files created by running ``make distribution'' in the source directory specified by -s srcdir, or a temporary copy of the reference files extracted from the binary sets specified by -s tgzfile, or a temporary copy of the reference files from the directory specified by -s tempdir. By default this is /tmp/temproot but can be changed either with this option or the TEMPROOT environ- ment variable. -v Makes etcupdate verbose about its actions. -w width Sets screen width used during interactive merge. By default this is the number of columns stty(1) reports but it can be changed either with this option or by defining the WIDTH variable. This is useful for xterm(1) users with wider shell win- dows. ENVIRONMENT
TEMPROOT Sets a default value for temproot. See -t above. SRCDIR The location of the NetBSD sources files. See -s above. PAGER The pager to use when displaying files. See -p above. WIDTH The screen width used during interactive merge. See -w above. IGNOREFILES A list of files that etcupdate should ignore. Files listed in this variable will never be considered for updating by etcupdate. FILES
The environment variables can also be defined in the following configuration files. The user's personal configuration file settings override the global settings. /etc/etcupdate.conf ~/.etcupdaterc EXAMPLES
You have just upgraded your NetBSD host from 3.0 to 4.0 and now it's time to update the configuration files as well. To update the configu- ration files from the sources (if you have the /usr/src/etc directory): etcupdate The default location of the source files is /usr/src but this may be overridden with the -s srcdir command line argument: etcupdate -s /some/where/src To update the configuration files from binary distribution sets do something like this: etcupdate -s /some/where/etc.tgz -s /some/where/xetc.tgz or like this: mkdir /tmp/temproot cd /tmp/temproot tar -xpzf /some/where/etc.tgz tar -xpzf /some/where/xetc.tgz etcupdate -s /tmp/temproot You have modified only few files in the /etc directory so you would like install most of the updates without being asked. To automatically update the unmodified configuration files: etcupdate -a To get a better idea what's going on, use the -v flag: etcupdate -v SEE ALSO
cmp(1), more(1), rcs(1), sdiff(1), stty(1), aliases(5), postinstall(8) HISTORY
The etcupdate command appeared in NetBSD 1.6. In NetBSD 4.0, the -s tgzfile option was added, the -b tempdir option was converted to -s tgzdir, and the -s srcdir option was changed to refer to the top of the source directory tree rather than to the etc subdirectory. In NetBSD 5.0, the ability to specify multiple colon-separated files with a single -s option was deprecated, and options deprecated in NetBSD 4.0 were removed. AUTHORS
The script was written by Martti Kuparinen <martti@NetBSD.org> and improved by several other NetBSD users. The idea for this script (including code fragments, variable names etc.) came from the FreeBSD mergemaster (by Douglas Barton). Unlike the FreeBSD mergemaster, this does not use CVS version tags by default to compare if the files need to be updated. Files are compared with cmp(1) as this is more reliable and the only way if the version numbers are the same even though the files are different. BUGS
If a source directory is specified via the ``-s srcdir'' option (or if the /usr/src directory is used by default), then etcupdate will run ``make distribution'' in the etc subdirectory of the source directory, but it will not use the same options or environment variables that would be used during a full build of the operating system. For this reason, use of the ``-s srcdir'' option is not recommended, and use of the ``-s tgzdir'' or ``-s tgzfile'' options is recommended. BSD
October 4, 2008 BSD
All times are GMT -4. The time now is 08:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy