我正在尝试// Protected route test
module.exports.memberInfo = function(req, res){
//how do i access the "app" here?
res.status(200).send({ user: req.user });
}
目录中的文件,在其上运行select
,然后将其重命名为已创建的新目录。除了将重命名应用于新目录中的文件之外,下面的grep
执行以上所有操作。因此,如果选择了bash
,则在运行file1.txt
之后,该文件将在新目录中重命名为bash
。它似乎很有效但尚未完成。谢谢你:)。
文件目录
file1_OTHER.txt
击
file1.txt
file2.txt
新目录 - # select file
printf "please select a file to analyze with entered gene or genes \n"
select file in $(cd /home/files;ls); do
break
done
echo $file "will be used"
# enter gene input
printf "%s \n" "Please enter id, use a comma between multiple:"
OLDIFS=$IFS
IFS=","
read -a id
for (( i = 0; i < ${#id[@]}; i++ ))
do
printf "%s\n" "${id[$i]}" >> /home/list.bed
done
# match input with id
grep -wFf /home/list.bed /home/targets.bed > /home/match.bed
logfile=/home/process.log
for file in /home/$file; do
echo "Start selected file creation: Date: $(date) - File: $file"
bname=$(basename $file)
pref=${bname%%.txt}
cp -f "$file" /home/reads/"${pref%%_OTHER}.txt"
echo "End selected file creation: $(date) - File: $file"
done >> "$logfile"
(执行/home/reads
后所需的输出)
bash
答案 0 :(得分:0)
以下对我有用,我只需要设置IFS
,因此它不会寻找,
作为文件分隔符。谢谢你:)。
# enter gene input
printf "%s \n" "Please enter id, use a comma between multiple:"
OLDIFS=$IFS
IFS=$OLDIFS
read -a id
for (( i = 0; i < ${#id[@]}; i++ ))
do
printf "%s\n" "${id[$i]}" >> /home/list.bed
done
# select file
printf "please select a file to analyze with entered gene or genes \n"
select file in $(cd /home/files;ls); do
break
done
echo $file "will be used"
# match input with id
grep -wFf /home/list.bed /home/targets.bed > /home/match.bed
logfile=/home/process.log
for file in /home/$file; do
echo "Start selected file creation: Date: $(date) - File: $file"
bname=$(basename $file)
pref=${bname%%.txt}
cp -f "$file" /home/reads/"${pref%%_OTHER}.txt"
echo "End selected file creation: $(date) - File: $file"
done >> "$logfile"