sh

Bash shell: How to check for specific date format?

一曲冷凌霜 提交于 2019-12-06 14:23:14
问题 I have a Bash shell script which checks to see if a shell variable contains a number: if ! [[ "$step" =~ ^[0-9]+$ ]] then exec >&2; echo "error: $step is Not a step number."; exit 1 fi Now I need to do a similar check to see if a variable contains the date in the required format which is YYYY-MM-DD (example: today is 2013-05-13) with the dashes. How can this be done with a regular expression in Bash shell or do I need an external program to do this? 回答1: regex is not the right tool to do the

Execute symbolicatecrash from shell script

走远了吗. 提交于 2019-12-06 11:48:35
I am trying to call symboliccrash from a shell script that loops through multiple crash log file and outputs symbolicated version, but it is failing with an error message saying "command not found" But it works fine in the command line. symboliccrash CRASH_FILE.crash APP.dSYM > symbolicated.crash I tried to find the source for symboliccrash but it fails to find it which -a symboliccrash Shell Script Code #!/usr/bin/bash export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" i=0 for x in *.crash; do symboliccrash $x MyApp.dSYM > $i.crash i=$((i+1)) done Response compareUUD.sh: line 7

sh.exe is preventing windows cmd move command from working

馋奶兔 提交于 2019-12-06 11:42:01
I am running an old application called ACSLX . It is trying to call a DOS move command, but because sh.exe is in my path, I am getting an error. sh.exe is part of Git and also RTools , both of which I have installed. As you can see it is simply trying to move a file, but this is failing. How can I prevent this? This is the console output of ACSLX when I try to build the "Spring" example project. ##### Build starting... C:\acslX\ShSysTime.exe Current System Time 15:05:02 "C:\acslX\atrans.exe" -lic_path "C:\acslX\license.lic;C:\acslX\*.lic" -no_xsl -no_compile -no_link "C:\acslX\Examples\MODELD

Combining wget and zenity/yad

女生的网名这么多〃 提交于 2019-12-06 11:15:37
问题 I'm trying to provide some kind of a GUI for wget download process by using zenity/yad. I have come up with this: wget http://example.com/ 2>&1 | \ sed -u 's/^[a-zA-Z\-].*//; s/.* \{1,2\}\([0-9]\{1,3\}\)%.*/\1\n#Downloading... \1%/; s/^20[0-9][0-9].*/#Done./' | \ zenity --progress --percentage=0 --title=Download dialog --text=Starting... --auto-close --auto-kill Now, suppose wget runs into an error. I need to inform the user that the download failed. Since the $? variable seems to have a

LaunchD Plist not working

99封情书 提交于 2019-12-06 09:30:52
EDIT: It appears as if I am getting an error in the console com.apple.launchd: (com.xxxx.adbind[57]) Exited with code: 1 What does that even mean? Also; if I load the launchd plist file logged in by using the launchctl command it works fine! I'm driving myself crazy trying to figure out why my launchd is not working. I'm using this in Mountain Lion 10.8.2 When I manually start it using launchctl it says it's loaded, but the script is not running. The script when ran manually works fine as well. Perhaps it just needs a better set of eye's to look at what I'm doing. First, I'll explain what it

tmux: how to open file under cursor

无人久伴 提交于 2019-12-06 09:30:24
i am a vim user and got used to the gf command, which opens the file under the cursor. Now i wanted to ask, if there is something like that for tmux. I can navigate through a tmux-pane and it happens often that there is a file-path under the cursor. Now i like to have the possibility to open that file under the cursor with vim. A: in the current window B: in another window which includes and opened vim Maybe there is a possibility to run a sh-script in that navigation-mode when invoking a special key-combination? that would make it possible to write my own scripts like i got used to in vim

How to run shell script file on ipython at Google Colab

不羁岁月 提交于 2019-12-06 09:23:35
问题 I'd like to know how to run a bash sell script file on ipython(jupyter notbook) at Google Colab. I downloded an Deep-learning codes package from github and upload them on my google drive and I mount the goole drive on Google Colab The code package includes'*.py' python codes and 'fn.sh' script file. By executing the script file the python codes can be executed. I tried os.system('fn.sh') and subprocess.call('fn.sh') on the ipython prompt at Google Colab but they doesn't work like below. 1)

Write some lines to a file with a bash script

陌路散爱 提交于 2019-12-06 08:33:10
问题 How can I write some lines to a file in a bash script? I want to write the following into a file ~/.inputrc "\e[A": history-search-backward "\e[B": history-search-forward "\e[C": forward-char "\e[D": backward-char Currently I have this working but somewhat ugly method, and I'm sure there should be a better way. #!/bin/sh echo \"\\e[A\": history-search-backward > ~/.inputrc echo \"\\e[B\": history-search-forward >> ~/.inputrc echo \"\\e[C\": forward-char >> ~/.inputrc echo \"\\e[D\": backward

ERROR: “/app/etc/” must exist for proper tool work magento 1.9

为君一笑 提交于 2019-12-06 07:33:26
I am trying to install the newly release security patch for magento 1.9. I am working on window system. and I am getting the following error. D:\xampp\htdocs\magento>sh PATCH_SUPEE-1533_EE_1.13.x_v1-2015-02-10-08-18-32.sh ERROR: "/app/etc/" must exist for proper tool work. I am running command by CMD and SH is working fine too I tried with Git too. but getting same error Not working on Linux too can anyone tell me what is the exact issue and how it could be fixed. Thanks Able to make it works on windows machine as well for PATCH_SUPEE-5344_CE_1.8.0.0_v1-2015-02-10-08-10-38.sh. Problem was:

Run shell script on docker from shared volume

牧云@^-^@ 提交于 2019-12-06 06:05:58
I have a docker container that has a shared volume with the host. The volume mounts in the root home folder. In that folder, I have a shell script I want to run once the container is up and running. I was using this command: docker exec -i localserver_web_1 sh /root/scripts/define_applications.sh but I'm getting this response: sh: 0: Can't open /root/scripts/define_applications.sh The script is working fine when I run it from inside the container. It says it's in /root/scripts/. I have permissions set at 777. What could I be doing wrong? VonC Just to be sure, try and exec as root, with a tty,