File: renametest.sh

package info (click to toggle)
hypre 2.15.1-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 43,332 kB
  • sloc: ansic: 318,026; cpp: 64,668; sh: 9,850; fortran: 9,442; perl: 3,050; makefile: 2,535; awk: 147; csh: 2
file content (46 lines) | stat: -rwxr-xr-x 1,369 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#BHEADER**********************************************************************
# Copyright (c) 2008,  Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# This file is part of HYPRE.  See file COPYRIGHT for details.
#
# HYPRE is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License (as published by the Free
# Software Foundation) version 2.1 dated February 1999.
#
# $Revision$
#EHEADER**********************************************************************

# Echo usage information
case $1 in
   -h|-help)
      cat <<EOF

   $0 [-h] {test_name} {new_test_name}

   where: -h|-help      prints this usage information and exits

   This script renames the files/directories associated with a test.

   Example usage: $0 basictest specifictest

EOF
      exit
      ;;
esac

oldname=$1;
newname=$2;

if [ -e $oldname.dir ]; then mv $oldname.dir $newname.dir; fi
if [ -e $oldname.err ]; then mv $oldname.err $newname.err; fi
if [ -e $oldname.out ]; then mv $oldname.out $newname.out; fi
if [ -e $oldname.fil ]; then mv $oldname.fil $newname.fil; fi

# # This code doesn't work when '/' appears in the sed script names
# for i in $oldname.???
# do
#    echo $i $oldname $newname
#    j=`echo $i | sed s/$oldname/$newname/`
#    echo mv $i $j
# done