what is - gets is a directory - error message
When you call gets.chomp
you're actually referring to Kernel#gets
, which expects a file to read from. If you are passing command line arguments, they'll be interpreted as these input files Kernel#gets
expects. If one of the args is a directory path, then you'll get the error you mentioned.
You want to use IO#gets
instead. This will work as expected:
def move_human(game)
puts "human move..."
@move = $stdin.gets.chomp
end
I'm getting is a directory error when trying unlink directory
unlink is used to delete files, use rmdir
Please note, you must first delete all files in directory.
Also, your code is very dangerous. Assume with time, you have 100,000 users so will have 100,000 folders. Can you imagine how much time will this line take?
foreach ($dir_files as $username) {
Please think alternate way.Good way, don't delete users from your database. find users who didn't login since 6 months (say) and disable them. this way, your loop is smaller.
Using gets() gives No such file or directory error when I pass arguments to my script
It looks like you want to the user to type some input by reading a line from STDIN
, the best way to do this is by calling STDIN.gets
and not gets
. So your line becomes:
word = STDIN.gets.chomp
This is documented as IO.gets
. STDIN
is an instance of IO
.Right now, you're executing Kernel.gets
, which does something different (emphasis mine):
This appears to behave likeReturns (and assigns to $_) the next line from the list of files in ARGV (or $*), or from standard input if no files are present on the command line.
STDIN.gets
if ARGV
is empty, but is not the same thing, hence the confusion. Getting slash is a directory error while running echo in bash
Use the single quote instead:
echo \
' __ __ _
/ / / /___ ____ _____ _(_)
/ / / / __ \/ __ `/ __ `/ /
/ /_/ / / / / /_/ / /_/ / /
\____/_/ /_/\__,_/\__, /_/
/____/
'
make[1]: Entering directory error message
Change make
to make -s
:
default:
@make -s build
@make -s run
Better still:default:
@$(MAKE) -s build
@$(MAKE) -s run
Even better:default: run
build:
@javac Test.java > /dev/null
run: build
@java Test
Related Topics
How to Unescape C-Style Escape Sequences from Ruby
Rails Routes: Nested, Member, Collection, Namespace, Scope and Customizable
Axlsx - Formatting Text Within a Cell
Unit Testing Code Which Gets Current Time
How to Use Strong Parameters with an Objects Array in Rails
Regex to Check Alphanumeric String in Ruby
How to Use Omniauth to Make Authenticated Calls to Services
What Are Ruby's Numbered Global Variables
Typeerror: Can't Convert Net::Httpok into String
How to Calculate a String's Width in Ruby
Download a Carrierwave Upload from S3
Require Tree in Asset Pipeline
How to Test If a Value Is a Prime Number in Ruby? Both The Easy and The Hard Way