如何使用bash脚本查找字符串出现的行号?
例如,如果文件看起来像这样,
Hello I am Isaiah
This is a line of text.
This is another line of text.
Run Code Online (Sandbox Code Playgroud)
我运行脚本来查找字符串"line",它将输出数字2,因为它是第一次出现.
我需要使用Parse.com提供的命令行工具从我的应用程序中获取最新的Cloud Code,我该怎么做?我正在与团队合作,无法覆盖现有的Cloud Code.
我正在使用Node.js,需要将文件保存到我的应用程序中的tmp目录.问题是Elastic Beanstalk没有将app目录设置为可由应用程序写入.因此,当我尝试创建临时目录时,我收到此错误
fs.js:653
return binding.mkdir(pathModule._makeLong(path),
^
Error: EACCES, permission denied '/var/app/tmp/'
at Object.fs.mkdirSync (fs.js:653:18)
at Promise.<anonymous> (/var/app/current/routes/auth.js:116:18)
at Promise.<anonymous> (/var/app/current/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.emit (events.js:95:17)
at Promise.emit (/var/app/current/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/var/app/current/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at /var/app/current/node_modules/mongoose/lib/query.js:1394:13
at model.Document.init (/var/app/current/node_modules/mongoose/lib/document.js:250:11)
at completeOne (/var/app/current/node_modules/mongoose/lib/query.js:1392:10)
at Object.cb (/var/app/current/node_modules/mongoose/lib/query.js:1151:11)
Run Code Online (Sandbox Code Playgroud)
我尝试过几个东西,例如.ebextensions/scripts/app-setup.sh中的app-setup.sh脚本,看起来像这样
#!/bin/bash
# Check if this is the very first time that this script is running
if ([ ! -f /root/.not-a-new-instance.txt ]) then
newEC2Instance=true
fi
# Get the directory of 'this' script
dirCurScript=$(dirname "${BASH_SOURCE[0]}")
# Fix the line endings of …Run Code Online (Sandbox Code Playgroud) javascript bash amazon-web-services node.js amazon-elastic-beanstalk
我在我的网站上托管视频内容,并使用签名网址来防止热链接.问题是当用户在Facebook上共享视频时,它只会获取当前的URL.一旦URL过期,Facebook将不会ping该页面以查看Open Graph元标记的新内容.
示例页面源显示以下内容.
<meta property="og:video" content="https://hackerbracket.s3.amazonaws.com/5370343b2e2862ad432d2b18-97423eaf1ab8690e4f91fdb725dbaf7c2a09dfd6-low.mp4?AWSAccessKeyId=AKIAIU7HRCRAOSCZTI6Q&Expires=1406058260&Signature=N43bR0ZY5I66WUVxRa7kQRm%2Bml4%3D&t=.mp4" />
Run Code Online (Sandbox Code Playgroud)
但是,刷新后内容将更改为以下内容.
<meta property="og:video" content="https://hackerbracket.s3.amazonaws.com/5370343b2e2862ad432d2b18-97423eaf1ab8690e4f91fdb725dbaf7c2a09dfd6-low.mp4?AWSAccessKeyId=AKIAIU7HRCRAOSCZTI6Q&Expires=1406058319&Signature=9SnbPIAoKTHBsZill3i8JJyvEcs%3D&t=.mp4" />
Run Code Online (Sandbox Code Playgroud)
请注意,t=.mp4因为当URL没有以MP4结束时,Facebook似乎不喜欢它,这是有史以来最奇怪的事情.
有没有解决这个问题的方法?我不希望我的视频静态可用.也许在S3中允许Facebook的HTTP推荐人?
facebook amazon-s3 amazon-web-services opengraph facebook-graph-api