• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Check parameters |Linux->Bash

jestem pro

That is the question
Joined
Apr 20, 2013
Messages
650
Solutions
14
Reaction score
87
Hello, I don't know where to put it in.

I have to write a code to my studies, and yes I have read a tutorial about it.

But I don't exactly know how to write this xddd

That sounds my task:
Create a script in bash called "create_catalog" having a directory name as the parameter. If we don't write any parameter, will send "there is no a parameter" otherwise "the catalog exists". And if there is no the catalog it should create one.

This is all. If someone can help me pls. Just how to check if the parameter is "string" or something.

Thanks guys.
 
The end of the term is approaching and I have to do that. If you study you know how it looks like.
Okay it will be something like this:
Lua:
#!/bin/bash
if [ $# -eq 0 ]
then
echo "gimme a parameter"
     elif [ -e ~/Desktop/$1 ]
       then
      echo "the catalog exists"
          else
       echo "the catalog has just created"
      `mkdir $1`
fi

Okay it's so fucking easy xdd.
But can anyone tell me how to modify this "`mkdir $1` cause it creates the catalog in a place where I actually am. Or is there any other way create files/catalogs etc>?
 
Last edited:
Back
Top