我正在尝试删除远程git分支
git push origin :my_remote_branch
Run Code Online (Sandbox Code Playgroud)
得到:
error: unable to push to unqualified destination: my_remote_branch
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@example.com:/myrepo'
Run Code Online (Sandbox Code Playgroud)
这些是我目前的分支机构
git branch -a
* develop
master
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/my_remote_branch
git branch -r --merged
origin/HEAD -> origin/master
origin/develop
origin/master
Run Code Online (Sandbox Code Playgroud)
关于如何摆脱这个分支的任何想法将不胜感激.
我有一个文本文件test.txt,其中包含以下内容:
text1
text2
Run Code Online (Sandbox Code Playgroud)
我想将文件的内容分配给UNIX变量,但是当我这样做时:
testvar=$(cat test.txt)
echo $testvar
Run Code Online (Sandbox Code Playgroud)
结果是:
text1 text2
Run Code Online (Sandbox Code Playgroud)
代替
text1
text2
Run Code Online (Sandbox Code Playgroud)
有人可以建议我解决这个问题吗?
我需要提取存档并在存档中包含的每个文件夹中创建一个空文件.
我试过这个:
for folder in `ls -d1 */` ; do touch "${folder}/COMPLETE"; done;
Run Code Online (Sandbox Code Playgroud)
工作得很完美,直到有人创建一个名称中有空格的文件夹.
如何在名称中包含或不包含空格的所有文件夹中执行此操作?
\雨果
我有一个脚本"task.sh",其中包含以下内容:
#!/bin/bash
CUR_DIR=`pwd`
SCRIPTPATH="${CUR_DIR}/`dirname $0`"
Run Code Online (Sandbox Code Playgroud)
当我用"bash task.sh"调用它时,它按预期工作,但是当用".task.sh"调用它时
$ . log/task.sh
dirname: invalid option -- b
Try `dirname --help' for more information.
Run Code Online (Sandbox Code Playgroud)
当在crontab中安排脚本时,它也不能正常工作.有人可以告诉我我做错了什么或以不同的方式获取不是当前目录的脚本目录?
我有一个具有该值的字符串Sam, Mathews, Perry.我需要知道如何查看PerryString中是否存在字符串.我怎样才能做到这一点;
我的代码如下,但不幸的是它不起作用.我需要帮助来解决这个问题.
var stringNames= "Sam, Mathews, Perry";
if (stringNames.contains ('Perry')) {
//
console.log('Perry found');
}
Run Code Online (Sandbox Code Playgroud)