File: copy.sh

package info (click to toggle)
eso-midas 15.09pl1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 146,960 kB
  • ctags: 55,836
  • sloc: ansic: 360,661; sh: 7,357; makefile: 6,229; pascal: 535; perl: 40; awk: 36; sed: 14
file content (22 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /bin/sh
# @(#)copy.sh	19.1 (ESO-IPG) 02/25/03 13:51:10
# .TYPE           command
# .NAME           copy.sh
# .LANGUAGE       shell script
# .ENVIRONMENT    Unix Systems. Executable under SHELL and C-SHELL
# .COMMENTS       Copy file in first argument ($1) to the local directory.
#		  If the file exists previously, then it is renamed.
# .AUTHOR         Carlos Guirao
# .VERSION 1.1    27-May-1988:		Implementation

if [ -d $1 ]; then
    if [ ! -d $MIDASHOME/$MIDVERS/local/$1 ]; then
	mkdir $MIDASHOME/$MIDVERS/local/$1
    fi
else
    if [ -f $MIDASHOME/$MIDVERS/local/$1 ]; then
	mv $MIDASHOME/$MIDVERS/local/$1  $MIDASHOME/$MIDVERS/local/${1}~
    fi
    cp $1  $MIDASHOME/$MIDVERS/local/$1
    chmod ug+rw $MIDASHOME/$MIDVERS/local/$1
fi