{"id":1147,"date":"2007-06-18T03:00:00","date_gmt":"2007-06-18T10:00:00","guid":{"rendered":"http:\/\/kodegeek.com\/blog\/?p=1147"},"modified":"2007-06-18T03:00:00","modified_gmt":"2007-06-18T10:00:00","slug":"trucos-unix-cuando-un-alias-no-es-suficiente","status":"publish","type":"post","link":"http:\/\/kodegeek.com\/blog\/2007\/06\/18\/trucos-unix-cuando-un-alias-no-es-suficiente\/","title":{"rendered":"Trucos UNIX: Cuando un alias no es suficiente"},"content":{"rendered":"<p>A mi me encanta UNIX por su linea de comandos. Sin embargo tambi\u00e9n me da una pereza increible escribir algo tan largo como esto cada vez que quiero notificar a los directorios de blogs que mi p\u00e1gina est\u00e1 actualizada:<\/p>\n<p><span style=\"font-family:courier new;\">\/Users\/josevnz\/bin\/ping_controller.sh veneblogs,weblogs,technorati,bitacoras.com,pingomatic kodegeek http:\/\/kodegeek.com<\/span><\/p>\n<p>Asi que un alias cae como anillo al dedo:<\/p>\n<p><span style=\"font-family:courier new;\"><span style=\"color: rgb(255, 0, 0);\">alias pingall<\/span>=&#8217;\/Users\/josevnz\/bin\/ping_controller.sh veneblogs,weblogs,technorati,bitacoras.com,pingomatic kodegeek http:\/\/kodegeek.com&#8217;<\/span><\/p>\n<p>Para despu\u00e9s escribir solamante &#8220;<span style=\"font-style: italic;\">pingall<\/span>&#8220;.<\/p>\n<p>Sin embargo, que ocurre si por ejemplo quisiera pasarle el titulo del blog a ciertos directorios como todosblogs.com cada vez que hago el ping:<\/p>\n<p>pingall &#8220;Este es otro post del fabuloso Kodegeek&#8221;<\/p>\n<p>Nada, no se puede. Con un alias estoy jodido porque no soportan argumentos.<\/p>\n<p>Pero no todo est\u00e1 perdido. Para eso simplemente ponemos una peque\u00f1a funci\u00f3n (les muestro la sintaxis en Bash) que nos haga el favor (primero haga <span style=\"font-style: italic;\">unlias ping<\/span> para eliminar el viejo alias):<\/p>\n<p><span style=\"font-family:courier new;\">function pingall {<\/span> <span style=\"font-family:courier new;\">\/Users\/josevnz\/bin\/ping_controller.sh veneblogs,weblogs,technorati,bitacoras.com,pingomatic kodegeek http:\/\/kodegeek.com $1<\/span> <span style=\"font-family:courier new;\">}<\/span><\/p>\n<p>Y si quiere guardar sus cambios entonces pongalos en su ~\/.profile, ~\/.bashrc o equivalente.<\/p>\n<p>Blogalaxia.com:<a href=\"http:\/\/www.blogalaxia.com\/tags\/alias\">alias<\/a>, <a href=\"http:\/\/www.blogalaxia.com\/tags\/bash\">bash<\/a>, <a href=\"http:\/\/www.blogalaxia.com\/tags\/function\">function<\/a>, <a href=\"http:\/\/www.blogalaxia.com\/tags\/unix\">unix<\/a><br \/>Technorati.com:<a href=\"http:\/\/technorati.com\/tag\/alias\">alias<\/a>, <a href=\"http:\/\/technorati.com\/tag\/bash\">bash<\/a>, <a href=\"http:\/\/technorati.com\/tag\/function\">function<\/a>, <a href=\"http:\/\/technorati.com\/tag\/unix\">unix<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A mi me encanta UNIX por su linea de comandos. Sin embargo tambi\u00e9n me da una pereza increible escribir algo tan largo como esto cada vez que quiero notificar a los directorios de blogs que mi p\u00e1gina est\u00e1 actualizada: \/Users\/josevnz\/bin\/ping_controller.sh veneblogs,weblogs,technorati,bitacoras.com,pingomatic kodegeek http:\/\/kodegeek.com Asi que un alias cae como anillo al dedo: alias pingall=&#8217;\/Users\/josevnz\/bin\/ping_controller.sh veneblogs,weblogs,technorati,bitacoras.com,pingomatic <a class=\"read-more\" href=\"http:\/\/kodegeek.com\/blog\/2007\/06\/18\/trucos-unix-cuando-un-alias-no-es-suficiente\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[95,94,93,96],"_links":{"self":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/posts\/1147"}],"collection":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/comments?post=1147"}],"version-history":[{"count":0,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/posts\/1147\/revisions"}],"wp:attachment":[{"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/media?parent=1147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/categories?post=1147"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kodegeek.com\/blog\/wp-json\/wp\/v2\/tags?post=1147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}