i am executing script file through php as shell_exec(sh script.sh) script.sh is the name of the script file. This script is used to transferring file say ‘abc’ to remote machine. When I execute script file through terminal as ./script.sh it successfully transfer file to remote machine but when execute same script file through php it could not transfer file to
Tag: shell
Possible to combine glob sort w/ alternation in zsh?
Looking for a shell-only[1] way to take this list of dirs: And return it sorted numerically, with the subdirs showing up right after their parent: (*|*/bar)(n) is rejected as a bad pattern, while */{,bar}(n) expands to */(n) ~/bar(n) so the subdirs show up at the end. [1] I need this to be able to work on a wide variety of
Use php exec to launch a linux command with brace expansion
How can I force the php exec() to interpret the linux brace expansion? I am encountering a strange behavior, and did not find a way to fix it the way I want. I want to execute a linux command containing brace expression to select a batch of files, from php I am using php to generate a “random” number of
How to extract something out of a file after greping?
How can I extract group-3-vm1 after I do this grep? Here’s the result: Answer This awk command replaces the grep and tail commands while also extracting the text of interest: How it works -F'[:/]’ This sets the field separator to either a colon or a slash. /Tracking URL/{n=$4;} This looks for lines containing Tracking URL and saves the fourth field
How do i split output of “who -m”command in linux?
I want to split output of who command and store output in variable EX. I want to split this output like Answer The following should work: Giving:
Embedding bash commands
I’m using virtualenvwrapper and trying to create a virtualenv using a version of python that’s not the default. What I’d like to do is: …But without the copy-paste. Is there a way to do this in one line? Answer is the correct way to write this as a one-liner. type is a POSIX standard utility, so it is more likely
Bash – How to print multi line strings (with ‘n’) using printf
i’m trying to print a multi line strings in printf this way I can’t do the following Is there any other way? Answer Quoting the variable should do the trick. In your example, however, you are getting double newlines.
Grep regexp for matching ip addresses in a file
I’m trying to search a file “Sessions” that contains IP addresses (among other useless junk). My Grep is failing to match, even though REGEXR is matching perfectly all the IPs perfectly … so I know the REGEX is correct … but when I GREP for this same pattern, not is returned. I’ve tried a variation of ways on that GREP
How to make zsh `run-help` to ignore `sudo` and get help about the following command
Is it possible to customize zsh so that when I type, say, sudo ls and then hit Alt-h to see man page of the command ls. The default behavior of run-help is to show me the man page of the command sudo, instead of ls. Answer Yes, you can. Run the following lines or add them to your .zshrc. from
In C# , how to set English time zone when formating a DateTIme?
private static SimpleDateFormat formatter = new SimpleDateFormat(“dd/MMM/yyyy:HH:mm:ss Z”, Locale.ENGLISH); string startTime = formatter.format(DateTime.Now); //请求时间 Those are Java codes. Can you help me convert the Java codes to equaivlent(equal) C#(.net) codes? I know to use DateTime.Now.ToString(“dd/MMM/yyyy:HH:mm:ss Z “) ,but the core problem is that I don’t know how to set the time to English time. I have struggled for half a