forked from Pokerpoke/LeetCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_template
More file actions
executable file
·35 lines (31 loc) · 910 Bytes
/
Copy pathgenerate_template
File metadata and controls
executable file
·35 lines (31 loc) · 910 Bytes
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
#!/bin/bash
################################################################################
#
# Copyright (c) 2019 NUAA AeroLab
#
# @author Jiang Yang (pokerpoke@qq.com)
# @date 2019-05
# @brief
# @version 0.0.1
#
# Last Modified: 2019-05-21
# Modified By: Jiang Yang (pokerpoke@qq.com)
#
################################################################################
set -e
# get scripts directory
CMAKE_SOURCE_DIR=$(dirname $(readlink -f $0))
# update cmake source path
CMAKE_SOURCE_DIR=$(pwd)
cd ${CMAKE_SOURCE_DIR}
if [ ! -n "$1" ]; then
echo "Please input solution."
exit 1
else
SOLUTION=$1
ID=$(echo ${SOLUTION} | sed 's/.[^.]*$//g')
SOLUTION=$(echo ${SOLUTION} | sed 's/^.*\.//g')
fi
cp -f ${CMAKE_SOURCE_DIR}/src/0.template.cc ${CMAKE_SOURCE_DIR}/src/${ID}.${SOLUTION}.cc
sed -i "s/isValid/$(expr ${SOLUTION})/g" \
${CMAKE_SOURCE_DIR}/src/${ID}.${SOLUTION}.cc