ls command does not work in VxWorks target prompt - ftp

I am new to vxworks and getting the problem after loading the VxWorks image from host machine to target machine. After loading the image at target machine(including build in symbol table), I am getting issue in commands cd, ls etc. cd command is getting success but while executing ls command after the cd it shows error as value = -1 = 0xffffffff(print error code as 0x3d0004). I am not able to resolve the issue after a lot of tried in building the VxWorks images. Request anyone to please help in this regard. I am also not sure whether the cd command is executed successfully or not since I am not able to see any FTP message on the network while executing the CD or LS command.
Thanks
Vaibhav

Propably the initial directory is not set. Try changing to one of the drives of your machine (e.g. cd "/tffs0") before using ls or commands like that.
To obtain a list of all available devices type devs.

Related

Bash script can't find file in /opt and gives strange error message

I am trying to use a simple bash script that uses a script in /opt
#!/bin/bash
pvpython=/opt/paraviewopenfoam54/bin/pvbatch
script_path=save_contours.py
$pvpython $script_path
The file pvbatch does exist, however when I try to run the script I get this strange error message which feels like it is missing some characters:
: No such file or directoryaviewopenfoam54/bin/pvbatch
The Ubuntu I am using is Ubuntu 18.04.1 LTS inside a Windows subsystem for Linux. What could cause this error message?
When I run ls -al pvbatch in /opt/paraviewopenfoam54/bin I get
-rwxr-xr-x 1 root root 84200 May 29 2018 pvbatch
cat pvbatch returns an error message
cat: write error: Input/output error
So cat cant read the file which is strange!
My first thought is that there is an issue with the file itself. where was the file created? I see that it is under /opt/paraviewopenfoam54/bin which is a linux managed folder, did you create and edit the file using vim in WSL or did you create it in windows somehow with VS Code or the like?
Let me just check that you are not creating and editing files in windows directly in the /opt folder inside the %LOCALAPPDATA% folders. If the file was created in this method you risk corrupting the WSL installation. Dont Edit WSL files
When using WSL I commonly find issues and especially this Input/output error issue whenever I create a file directly from windows into the Linux filesystem. There are essentially three main ways to fix this specific issue: (these are not steps but rather separate solutions)
-Restart your Ubuntu terminal
-Restart your entire computer
-Delete the file directly from Windows, touch the file, then overwrite the file with the old one
For a more scalable solution, I recommend leaving the file within the windows system and only working within the Linux system within Linux.

Run script on remote server from local machine

I have a remote script on a machine (B) which works perfectly when I run it from machine (B). I wanted to run the script via ssh from machine (A) using:
ssh usersm#${RHOST} './product/2018/requests/inbound/delDup.sh'
However, machine (A) complains about the contents of the remote script (2018req*.txt is a variable defined at the beginning of the script):
ls: cannot access 2018req*.txt: No such file or directory
From the information provided, it's hard to do more than guess. So here's a guess: when you run the script directly on machine B, do you run it from your home directory with ./product/2018/requests/inbound/delDup.sh, or do you cd into the product/2018/requests/inbound directory and run it with ./delDup.sh? If so, using 2018req*.txt will look in different places; basically, it looks in the directory that you were in when you ran the script. If you cded to the inbound directory locally, it'll look there, but running it remotely doesn't change to that directory, so 2018req*.txt will look for files in the home directory.
If that's the problem, I'd rewrite the script to cd to the appropriate directory, either by hard-coding the absolute path directly in the script, or by detecting what directory the script's in (see "https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within" and BashFAQ #28: "How do I determine the location of my script? I want to read some config files from the same place").
BTW, anytime you use cd in a script, you should test the exit status of the cd command to make sure it succeeded, because if it didn't the rest of the script will execute in the wrong place and may do unexpected and unpleasant things. You can use || to run an error handler if it fails, like this:
cd somedir || {
echo "Cannot cd to somedir" >&2
exit 1
}
If that's not the problem, please supply more info about the script and the situation it's running in (i.e. location of files). The best thing to do would be to create a Minimal, Complete, and Verifiable example that shows the problem. Basically, make a copy of the script, remove everything that isn't relevant to the problem, make sure it still exhibits the problem (otherwise you removed something that was relevant), and add that (and file locations) to the question.
First of all when you use SSH, instead of directly sending the output (stdout and stderr) to the monitor, the remote machine/ssh server sends the data back to the machine from which you started the ssh connection. The ssh client running in your local machine will just display it (except if you redirect it of course).
Now, from the information you have provided, it looks like the files are not present on server (B) or not accessible (last but not least, are you sure your ls target the proper directory? ) you could display the current directory in your script before running the ls command for debugging purpose.

Command not found

I am quite new to the Mac Terminal environment.
I donwloaded sqlplus (which is recognised as a UNIX executable program) and then in Terminal I do cd a few times until I arrive in the folder I put this in (\Applications\instantclient_10) in this case.
When I type 'ls' I see a listing of all the files including the sqlplus. So I would then expect to simply type at the Telnet prompt 'sqlplus' and then this would start but instead keep getting
-bash: sqlplus: command not found
This is problem one.
I have now downloaded MySQL and again, when I go to the correct folder (\Library\StarupItems\MySQLCOM) and I type 'ls' I see my files (including MySQLCOM) but when I come to try to 'run' this by simply typing 'MySQLCOM' again the message is:
-base: MySQLCOM: command not found
What am I doing wrong?
Thanks
To run binary/executables in current folder you need to prefix them with ./
./sqlplus
The idea here is that you want to force execution of local file and not run it accidentally. Imagine app that would put ls binary into it's folder and it would automatically run if did ls in that folder.

Problem setting up github repository, touch not recognized in CMD

When I get to the step:
touch README
I get the error
'touch' is not recognized as an internal or external command, operable program or batch file.
What does this mean?
I'm in Win 7 Home Premium command prompt.
Make sure you're working in git bash, not cmd.
The touch command updates the last-modified timestamp of the file to the current time, or if the file doesn't already exist, creates an empty file with the given name. This command does not exist (by default) in Windows, which is the reason you get that error message.
To get past this step, you can create a file called README in whatever way you feel most comfortable with. For example, you could use notepad.exe if you have no better alternative available.
Use this code in CMD and then touch your file
npm install touch-cli -g

Is there a way of listing the contents of the local directory in ftp?

lcd changes local directories.
ls lists files on remote directory.
What I would like is lls, to list files on local directory.
Is this possible?
I know I can always open another terminal to do this, but I'm lazy!
Yes:
!dir
The ! tells the client to run a local shell command. Tested this using both the Windows and Fedora default ftp clients. Note that the actual command may depend upon your OS, for example !ls may be necessary on other versions of Unix/Linux.
For what it's worth, the ! command is listed in the ftp client's help system:
ftp> help !
! escape to the shell
To list files locally use following command
!dir
Or use following command
!ls
Note: ! means locally not the remote.
lcd is working but !cd will not work and lpwd is not working but !pwd is working.

Resources