我需要编写一个bash脚本,该脚本查找并列出来自一个目录的符号链接(让我们说一些“ Directory1”),但是只有指向某个特定目录中文件的链接(让我们说“ Directory2”)。我不能使用“查找”。
我已经尝试过类似的操作,但这显然是错误的:
if [[ -d $1 ]]&&[[ -d $2 ]]
then
current_dir='pwd'
cd $1
do
for plik in *
if[[-L $file] && ["$(readlink -- "$file")" = "$2"] ]
then
#ls -la | grep ^l
echo "$(basename "$file")"
fi
done
fi
答案 0 :(得分:0)
使用grep的简单ls如何?
ls -l Directory1/ | grep "\->" | grep "Directory2"
答案 1 :(得分:0)
我找到了解决方法:
<label htmlFor="newsletterEmail" style={{ display: "none" }}>
Email
</label>
<input
type="email"
name="newsletterEmail"
placeholder="Email Address"
onChange={this.handleChange}
value={this.state.newsletterEmail}
/>