OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [tools/] [riscv-gnu-toolchain-master/] [scripts/] [cp_s] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
#!/bin/sh
2
# Emulate cp -s for systems without coreutils
3
 
4
if test -z "$1" || test -z "$2" ; then
5
        echo "usage: ${0} srcdir destdir" >&2
6
        exit 1
7
fi
8
 
9
# Portability notes:
10
# - Avoid set -e given its ambiguous interaction with subshells.
11
# - Not all shells update $PWD as required by POSIX.
12
#   Use the pwd builtin instead.
13
# - Command substitution strips all trailing newlines.
14
#   Preserve trailing newlines by appending a safety character and then
15
#   removing it with parameter substitution, along with the newline
16
#   appended by pwd itself.
17
 
18
mkdir -p "$2" &&
19
destdir=`cd "$2" && pwd && echo x` &&
20
destdir=${destdir%??} &&
21
 
22
cd "$1" &&
23
srcdir=`pwd && echo x` &&
24
srcdir=${srcdir%??} &&
25
find . -type d -exec mkdir -p "${destdir}/{}" \; &&
26
find . -type f -exec ln -sf "${srcdir}/{}" "${destdir}/{}" \;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.