command-line-interface

PHP CLI: How to read a single character of input from the TTY (without waiting for the enter key)?

落爺英雄遲暮 提交于 2019-11-27 00:57:59
I want to read a single character at-a-time from the command line in PHP, however it seems as though there is some kind of input buffering from somewhere preventing this. Consider this code: #!/usr/bin/php <?php echo "input# "; while ($c = fread(STDIN, 1)) { echo "Read from STDIN: " . $c . "\ninput# "; } ?> Typing in "foo" as the input (and pressing enter), the output I am getting is: input# foo Read from STDIN: f input# Read from STDIN: o input# Read from STDIN: o input# Read from STDIN: input# The output I am expecting is: input# f input# Read from STDIN: f input# o input# Read from STDIN: o

aws eb cli 3 sets up application for wrong account

99封情书 提交于 2019-11-27 00:45:27
问题 I have multiple AWS accounts and I'm trying out the new command line interface for elastic beanstalk EB CLI 3. When I run the following command eb init I get prompted for the region (good) and then it asks me to "Select an application to use" where it lists the applications from another AWS account (for staging). If I go ahead and "Create new application" that application will be created in my staging account. Is there some way to configure eb cli3 and get it to use different access keys? 回答1

Mac OS: /usr/bin/env: bad interpreter: Operation not permitted

☆樱花仙子☆ 提交于 2019-11-27 00:34:46
问题 I'm trying to run this script on Mac OS 10.7 (Lion) and I'm getting the error: $ bbcolors -bash: /usr/local/bin/bbcolors: /usr/bin/env: bad interpreter: Operation not permitted I've successfully run this script on other Macs of mine. It's just this script downloaded and unmodified from Daring Fireball. I found this person with a very similar problem but the accepted answer was that the filesystem had a 'noexe' option on mount. I'm pretty sure that's not the case for me because I've just got

PHP, pass parameters from command line to a PHP script

て烟熏妆下的殇ゞ 提交于 2019-11-27 00:29:01
问题 I want to pass parameters from PHP Command Line Interface, and then read in the values using PHP script, something like this: <?php $name1 = $argv[1]; echo $name1; ?> I pass the variable from CLI like this: C:\xampp\php\php.exe name.php Robby The above works, I get Robby as the output. But I want to do something like this: C:\xampp\php\php.exe name.php -inputFirstName="Robby" So that the user is well informed to enter the correct parameters in the correct places. What is the appropriate way

Fatal error: Maximum execution time of 300 seconds exceeded

☆樱花仙子☆ 提交于 2019-11-27 00:04:38
I keep getting this PHP error: Fatal error: Maximum execution time of 300 seconds exceeded I have tried setting my max_execution_time and my max_input_time settings in php.ini (both apache and cli) to 0 , -1 and 4000 seconds each. And i still get the error saying: Fatal error: Maximum execution time of 300 seconds exceeded As well my script runs over 300 seconds before i get this message I am running the script through command line. I also checked my phpinfo() so see which php.ini I am using. Even more interesting I have tried setting max_execution_time and max_input_time settings to 5 second

Redirect stdout pipe of child process in Go

丶灬走出姿态 提交于 2019-11-26 23:51:00
问题 I'm writing a program in Go that executes a server like program (also Go). Now I want to have the stdout of the child program in my terminal window where I started the parent program. One way to do this is with the cmd.Output() function, but this prints the stdout only after the process has exited. (That's a problem because this server-like program runs for a long time and I want to read the log output) The variable out is of type io.ReadCloser and I don't know what I should do with it to

Send POST Request with Data Specified in File via Curl

戏子无情 提交于 2019-11-26 23:41:53
I need to make a POST request via Curl from the command line. Data for this request is located in a file. I know that via PUT this could be done with the --upload-file option. curl host:port/post-file -H "Content-Type: text/xml" --data "contents_of_file" Richard J You're looking for the --data-binary argument: curl -i -X POST host:port/post-file \ -H "Content-Type: text/xml" \ --data-binary "@path/to/file" In the example above, -i prints out all the headers so that you can see what's going on, and -X POST makes it explicit that this is a post. Both of these can be safely omitted without

Use different PHP version CLI executable for one command

痞子三分冷 提交于 2019-11-26 19:42:46
问题 So I have Gentoo box with three PHP versions installed (nevermind the reasons): /usr/bin/php -> /usr/lib64/php5.4/bin/php /usr/bin/php5.5 -> /usr/lib64/php5.5/bin/php /usr/bin/php5.6 -> /usr/lib64/php5.4/bin/php I want to install Laravel framework using composer: $ composer create-project laravel/laravel --prefer-dist This however throws an error because Laravel requires PHP > 5.5.9 and the default php interpreter is 5.4 . So I issue another command: $ /usr/bin/php5.6 /usr/bin/composer create

Command prompt won't change directory to another drive

╄→尐↘猪︶ㄣ 提交于 2019-11-26 18:43:38
问题 I'm trying to compile some java (learning java currently), and to do so I need to change command-prompt's directory (using javac). C:\...\Admin> cd D:\Docs\Java C:\...\Admin> cd C:\...\Admin It doesn't change the directory. I try again using quotes: C:\...\Admin> cd "D:\Docs\Java" C:\...\Admin> Again it doesn't change the directory. What am I doing wrong? 回答1: As @nasreddine answered or you can use /d cd /d d:\Docs\Java For more help on the cd command use: C:\Documents and Settings\kenny>help

Javac “cannot find symbol”

十年热恋 提交于 2019-11-26 18:30:48
问题 I've the root directory like this : ├── classes └── src └── vehicles ├── Bicycle.java └── BicycleMain.java Bicycle.java package vehicles; public class Bicycle { public int cadence; public int gear; public int speed; public Bicycle(int startCadence, int startSpeed, int startGear) { gear = startGear; cadence = startCadence; speed = startSpeed; } public void setCadence(int newValue) { cadence = newValue; } public void setGear(int newValue) { gear = newValue; } public void setSpeed(int newValue)