Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

It looks like the problem here is how you're using the tilde ~ character; you need to separate it from the cs50 subfolder with a forward-slash / character.

The tilde ~ is a special character recognized by the cs50 appliance's command-line interpreter, or shell, as a shortcut for your home directory. When you issue a shell command with an unquoted tilde, the interpreter replaces that special character with the contents of the $HOME environment variable.

When you are logged into the appliance normally, the $HOME environment variable should contain the path /home/jharvard. You can check this by issuing the commands echo $HOME and echo ~ in the shell; they should both print the same path.

However, if you try echo ~cs50 you'll see that the special character is not expanded. The interpreter only treats it as a shortcut for your home directory when used on its own or in place of a folder name at the beginning of a file path. You're allowed to use the tilde ~ character in file names, so the interpreter won't expand the tilde in ~cs50 in case there is a file named ~cs50 that you're trying to access.

This is the case with all relative path shortcuts - e.g., to run a file in your current directory, you would issue the command as ./filename rather than .filename. It is possible to create files with the same name as these shortcuts, by escaping or quoting the special characters, but this is a very bad idea; it confuses users and in the worst case could lead to accidental deletion of the home directoryaccidental deletion of the home directory.

It looks like the problem here is how you're using the tilde ~ character; you need to separate it from the cs50 subfolder with a forward-slash / character.

The tilde ~ is a special character recognized by the cs50 appliance's command-line interpreter, or shell, as a shortcut for your home directory. When you issue a shell command with an unquoted tilde, the interpreter replaces that special character with the contents of the $HOME environment variable.

When you are logged into the appliance normally, the $HOME environment variable should contain the path /home/jharvard. You can check this by issuing the commands echo $HOME and echo ~ in the shell; they should both print the same path.

However, if you try echo ~cs50 you'll see that the special character is not expanded. The interpreter only treats it as a shortcut for your home directory when used on its own or in place of a folder name at the beginning of a file path. You're allowed to use the tilde ~ character in file names, so the interpreter won't expand the tilde in ~cs50 in case there is a file named ~cs50 that you're trying to access.

This is the case with all relative path shortcuts - e.g., to run a file in your current directory, you would issue the command as ./filename rather than .filename. It is possible to create files with the same name as these shortcuts, by escaping or quoting the special characters, but this is a very bad idea; it confuses users and in the worst case could lead to accidental deletion of the home directory.

It looks like the problem here is how you're using the tilde ~ character; you need to separate it from the cs50 subfolder with a forward-slash / character.

The tilde ~ is a special character recognized by the cs50 appliance's command-line interpreter, or shell, as a shortcut for your home directory. When you issue a shell command with an unquoted tilde, the interpreter replaces that special character with the contents of the $HOME environment variable.

When you are logged into the appliance normally, the $HOME environment variable should contain the path /home/jharvard. You can check this by issuing the commands echo $HOME and echo ~ in the shell; they should both print the same path.

However, if you try echo ~cs50 you'll see that the special character is not expanded. The interpreter only treats it as a shortcut for your home directory when used on its own or in place of a folder name at the beginning of a file path. You're allowed to use the tilde ~ character in file names, so the interpreter won't expand the tilde in ~cs50 in case there is a file named ~cs50 that you're trying to access.

This is the case with all relative path shortcuts - e.g., to run a file in your current directory, you would issue the command as ./filename rather than .filename. It is possible to create files with the same name as these shortcuts, by escaping or quoting the special characters, but this is a very bad idea; it confuses users and in the worst case could lead to accidental deletion of the home directory.

Source Link
Air
  • 2.1k
  • 18
  • 29

It looks like the problem here is how you're using the tilde ~ character; you need to separate it from the cs50 subfolder with a forward-slash / character.

The tilde ~ is a special character recognized by the cs50 appliance's command-line interpreter, or shell, as a shortcut for your home directory. When you issue a shell command with an unquoted tilde, the interpreter replaces that special character with the contents of the $HOME environment variable.

When you are logged into the appliance normally, the $HOME environment variable should contain the path /home/jharvard. You can check this by issuing the commands echo $HOME and echo ~ in the shell; they should both print the same path.

However, if you try echo ~cs50 you'll see that the special character is not expanded. The interpreter only treats it as a shortcut for your home directory when used on its own or in place of a folder name at the beginning of a file path. You're allowed to use the tilde ~ character in file names, so the interpreter won't expand the tilde in ~cs50 in case there is a file named ~cs50 that you're trying to access.

This is the case with all relative path shortcuts - e.g., to run a file in your current directory, you would issue the command as ./filename rather than .filename. It is possible to create files with the same name as these shortcuts, by escaping or quoting the special characters, but this is a very bad idea; it confuses users and in the worst case could lead to accidental deletion of the home directory.