Save path to specific folder in shell script
I am working on a Bash shell script that does something like this:
#!/bin/bash
folder=/mnt
mkdir $folder/folder-`date +%开发者_如何转开发N`
var1=
Now i need to somehow get the full path for the newly created folder into var1. There is going to be created a lot of folders in /mnt so i need to be 100% sure that the path in var1 is pointing to precisely the folder created in the previous line.
use the $()
syntax whenever possible
#!/bin/bash
folder=/mnt
var1="$folder/folder-$(date +%N)"
mkdir "$var1"
Define var1
before creating the folder:
#!/bin/bash
folder=/mnt
var1=$folder/folder-`date +%N`
mkdir $var1
精彩评论