What Is - Gets Is a Directory - Error Message

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):

Returns (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.

This appears to behave like 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



Leave a reply



Submit