Creating a file using Pico under a different directory - unix

If I am trying to create a file name "Data01" using the Pico editor with the contents of "Data File Number 01" on one line.
However my current directory is
csc209/asgn06
I need to create these files in
csc209/asgn06/test01 without changing directories in one command. Is there a way to do this?

Just prefix the filename with a relative path. If the directory exists:
pico test01/Data01
Otherwise, first create it with:
mkdir test01
then proceed as above.

Related

Robot Framework how to set file path?

I am using Choose File keyword to upload file. In documentation is written that I can use ${CURDIR} to set the path to my file, but it means that this file has to be in the same directory ${CURDIR}/filename.txt. But how to set the path to the file that exists in another directory?
Use ${EXECDIR} so you go back to the root and go from there.

sftp uploading to non-existing directory

Say I have to upload file dir-a/dir-b/dir-c/xxx.txt using sftp
Should I create the target directory first?
Should I open target directory before copying the file?
If have to create this path dir-a/dir-b/dir-c - is it one command or three?
Should I create the target directory first?
Usually yes. SFTP servers usually do not create parent directory. But how hard is it to try first?
Should I open target directory before copying the file?
You do not have to. put command does accept a remote-path, which can be either absolute or relative to remote working directory.
If have to create this path dir-a/dir-b/dir-c - is it one command or three?
These are three commands:
mkdir dir-a/
mkdir dir-a/dir-b/
mkdir dir-a/dir-b/dir-c

IAR project variable like $PROJ_DIR$

Is there any possibility in IAR to add additional project variable like $PROJ_DIR$ to specify my project environment?
I like to keep my project portable and adaptable.
Of course there are, according to the manuals:
Variable / Description
$CONFIG_NAME$ The name of the current build configuration, for example Debug or Release.
$CUR_DIR$ Current directory
$CUR_LINE$ Current line
$DATE$ Today’s date
$EW_DIR$ Top directory of IAR Embedded Workbench, for example c:\program files\iar systems\embedded workbench 6.n
$EXE_DIR$ Directory for executable output
$FILE_BNAME$ Filename without extension
$FILE_BPATH$ Full path without extension
$FILE_DIR$ Directory of active file, no filename
$FILE_FNAME$ Filename of active file without path
$FILE_PATH$ Full path of active file (in Editor, Project, or Message window)
$LIST_DIR$ Directory for list output
$OBJ_DIR$ Directory for object output
$PROJ_DIR$ Project directory
$PROJ_FNAME$ Project filename without path
$PROJ_PATH$ Full path of project file
$TARGET_DIR$ Directory of primary output file
$TARGET_BNAME$ Filename without path of primary output file and without extension
$TARGET_BPATH$ Full path of primary output file without extension
$TARGET_FNAME$ Filename without path of primary output file
$TARGET_PATH$ Full path of primary output file
$TOOLKIT_DIR$ Directory of the active product, for example c:\program files\iar systems\embedded workbench 6.n\arm
$USER_NAME$ Your host login name
$ENVVAR$ The environment variable ENVVAR. Any name within $_ and _$ will
be expanded to that system environment variable.
If you go to Tools > Configure Custom Argument Variables you can add variables that you can address with $VARIABLE_NAME$. Not sure if that's exactly what you were looking for.
As a caution, if you are using IarBuild.exe to build from the command line, the workspace or global values set from "Configure Custom Arguments Variables" are not included in the project files (.ewp) and thus is not expanded by IarBuild.exe at build time. This is not an issue if you only use the IDE to build.
I found a reason for my problem (but it givs another one):
I define a windows "path-variable" like LIB_PATH and put it in the IAR project file with $_LIB_PATH_$.This works as long until i save the IAR-project. Then IAR sets all paths realive to $PROJ_DIR$ :-(

How to create Subdirectories using Windows Command Line?

How would I create one directory with four sub-directories? I'm having trouble with this question for a lab I'm doign.
What commands would you issue to build the following directory
structure on the hard drive: Create the directory PROGRAMS in the
root. In the PROGRAMS directory create four subdirectories called:
Adobe, Email, Graphics and MSOffice. In the first three subdirectories
create two user directories called: Personal and Guest. In the
MSOffice subdirectory create two subdirectories called: Word and
Excel. Include a Tree view drawing or printout of the directory
structure.
I know that to create a directory, you'd use
mkdir \programs
But I'm not sure that's even how you start.
Start with the outermost directory. (md and makedir are the same thing, and both works on Windows.)
md \Programs
Now create the next level (repeating for each one):
md \Programs\Adobe
Now the next level:
md \Programs\Adobe\Guest
Continue as needed.

Create a File with Touch on a specific Directory

I want a create a file with a specific extension(.done). I am using the command touch. Something Like:
touch `basename $UNZIPFILE`".done"
It's creating the file but in current directory. I want to create this file in a specific directory. Is there a option to provide the directory ?
I checked : http://ss64.com/bash/touch.html , but could not figure out.
I can think of one option is before this command I can do a cd requiredDIR
Is there any other way, I can specify the Directory on the same command, so that I dont have to change the Directory?
Simply prepend the directory variable to the file you are touching.
touch "$MYDIR/$(basename $UNZIPFILE).done"
If the directory doesn't exist, you need to create it.
mkdir -p "$MYDIR" && touch "$MYDIR/$(basename $UNZIPFILE).done"
(It's also better to use $(command) syntax instead of backticks for command substitution.)

Resources