Advertisement
Guest User

Untitled

a guest
Jul 30th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Obtiene la fecha del sistema
  4.  
  5. DATE=`date +%Y-%m-%d`
  6.  
  7. # Convierte en una cadena separada por guiones el nombre del archivo
  8.  
  9. NAME=`echo $* | tr " " -`
  10.  
  11. # Variable con el nombre FINAL del archivo
  12.  
  13. FILENAME=$DATE-$NAME.md
  14.  
  15.  
  16. # Crea un archivo con la fecha y el nombre indicado, como nombre de archivo.
  17.  
  18. touch $FILENAME
  19.  
  20. echo "---
  21. layout: post # Sustituye el layout si lo usas uno diferente
  22. title: $* # Nombre generado automáticamente
  23. categories: [] # Añade tus categorías o borra esta línea
  24. ---" > $FILENAME
  25.  
  26. echo "Nuevo post generado: $FILENAME
  27.  
  28. # Sustitute nano por tu editor de texto favorito (gedit, leafpad, vim, atom...)
  29.  
  30. nano $FILENAME
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement